diff --git a/modules/purchase_trade/__init__.py b/modules/purchase_trade/__init__.py
index b2fa644..3ef10bb 100755
--- a/modules/purchase_trade/__init__.py
+++ b/modules/purchase_trade/__init__.py
@@ -28,6 +28,7 @@ from . import (
open_position,
credit_risk,
valuation,
+ dimension,
weight_report,
service,
)
@@ -164,6 +165,9 @@ def register():
purchase.DocTemplate,
purchase.DocTypeTemplate,
purchase.PurchaseStrategy,
+ dimension.AnalyticDimension,
+ dimension.AnalyticDimensionValue,
+ dimension.AnalyticDimensionAssignment,
weight_report.WeightReport,
module='purchase', type_='model')
Pool.register(
diff --git a/modules/purchase_trade/dimension.py b/modules/purchase_trade/dimension.py
new file mode 100644
index 0000000..ab3745c
--- /dev/null
+++ b/modules/purchase_trade/dimension.py
@@ -0,0 +1,79 @@
+from trytond.model import fields
+from trytond.pool import Pool, PoolMeta
+from trytond.pyson import Bool, Eval, Id
+from trytond.model import (ModelSQL, ModelView)
+from trytond.tools import is_full_text, lstrip_wildcard
+from trytond.transaction import Transaction, inactive_records
+from decimal import getcontext, Decimal, ROUND_HALF_UP
+from sql.aggregate import Count, Max, Min, Sum, Avg, BoolOr
+from sql.conditionals import Case
+from sql import Column, Literal
+from sql.functions import CurrentTimestamp, DateTrunc
+from trytond.wizard import Button, StateTransition, StateView, Wizard
+import datetime
+import logging
+
+class AnalyticDimension(ModelSQL, ModelView):
+ 'Analytic Dimension'
+ __name__ = 'analytic.dimension'
+
+ name = fields.Char('Name', required=True)
+ code = fields.Char('Code', required=True)
+ active = fields.Boolean('Active')
+
+class AnalyticDimensionValue(ModelSQL, ModelView):
+ 'Analytic Dimension Value'
+ __name__ = 'analytic.dimension.value'
+
+ dimension = fields.Many2One(
+ 'analytic.dimension',
+ 'Dimension',
+ required=True,
+ ondelete='CASCADE'
+ )
+
+ name = fields.Char('Name', required=True)
+ code = fields.Char('Code')
+
+ parent = fields.Many2One(
+ 'analytic.dimension.value',
+ 'Parent',
+ domain=[
+ ('dimension', '=', Eval('dimension')),
+ ],
+ depends=['dimension']
+ )
+
+ children = fields.One2Many(
+ 'analytic.dimension.value',
+ 'parent',
+ 'Children'
+ )
+
+ active = fields.Boolean('Active')
+
+class AnalyticDimensionAssignment(ModelSQL, ModelView):
+ 'Analytic Dimension Assignment'
+ __name__ = 'analytic.dimension.assignment'
+
+ dimension = fields.Many2One(
+ 'analytic.dimension',
+ 'Dimension',
+ required=True
+ )
+
+ value = fields.Many2One(
+ 'analytic.dimension.value',
+ 'Value',
+ required=True,
+ domain=[
+ ('dimension', '=', Eval('dimension')),
+ ],
+ depends=['dimension']
+ )
+
+ purchase = fields.Many2One(
+ 'purchase.purchase',
+ 'Purchase',
+ ondelete='CASCADE'
+ )
\ No newline at end of file
diff --git a/modules/purchase_trade/dimension.xml b/modules/purchase_trade/dimension.xml
new file mode 100644
index 0000000..bd896cf
--- /dev/null
+++ b/modules/purchase_trade/dimension.xml
@@ -0,0 +1,34 @@
+