07.02.26
This commit is contained in:
@@ -28,6 +28,7 @@ from . import (
|
|||||||
open_position,
|
open_position,
|
||||||
credit_risk,
|
credit_risk,
|
||||||
valuation,
|
valuation,
|
||||||
|
dimension,
|
||||||
weight_report,
|
weight_report,
|
||||||
service,
|
service,
|
||||||
)
|
)
|
||||||
@@ -164,6 +165,9 @@ def register():
|
|||||||
purchase.DocTemplate,
|
purchase.DocTemplate,
|
||||||
purchase.DocTypeTemplate,
|
purchase.DocTypeTemplate,
|
||||||
purchase.PurchaseStrategy,
|
purchase.PurchaseStrategy,
|
||||||
|
dimension.AnalyticDimension,
|
||||||
|
dimension.AnalyticDimensionValue,
|
||||||
|
dimension.AnalyticDimensionAssignment,
|
||||||
weight_report.WeightReport,
|
weight_report.WeightReport,
|
||||||
module='purchase', type_='model')
|
module='purchase', type_='model')
|
||||||
Pool.register(
|
Pool.register(
|
||||||
|
|||||||
79
modules/purchase_trade/dimension.py
Normal file
79
modules/purchase_trade/dimension.py
Normal file
@@ -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'
|
||||||
|
)
|
||||||
34
modules/purchase_trade/dimension.xml
Normal file
34
modules/purchase_trade/dimension.xml
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
<tryton>
|
||||||
|
<data>
|
||||||
|
<record model="ir.ui.view" id="dimension_view_form">
|
||||||
|
<field name="model">analytic.dimension</field>
|
||||||
|
<field name="type">form</field>
|
||||||
|
<field name="name">dimension_form</field>
|
||||||
|
</record>
|
||||||
|
<record model="ir.ui.view" id="dimension_view_list">
|
||||||
|
<field name="model">analytic.dimension</field>
|
||||||
|
<field name="type">tree</field>
|
||||||
|
<field name="name">dimension_tree</field>
|
||||||
|
</record>
|
||||||
|
<record model="ir.ui.view" id="dimension_value_view_form">
|
||||||
|
<field name="model">analytic.dimension.value</field>
|
||||||
|
<field name="type">form</field>
|
||||||
|
<field name="name">dimension_value_form</field>
|
||||||
|
</record>
|
||||||
|
<record model="ir.ui.view" id="dimension_value_view_list">
|
||||||
|
<field name="model">analytic.dimension.value</field>
|
||||||
|
<field name="type">tree</field>
|
||||||
|
<field name="name">dimension_value_tree</field>
|
||||||
|
</record>
|
||||||
|
<record model="ir.ui.view" id="dimension_ass_view_form">
|
||||||
|
<field name="model">analytic.dimension.assignment</field>
|
||||||
|
<field name="type">form</field>
|
||||||
|
<field name="name">dimension_ass_form</field>
|
||||||
|
</record>
|
||||||
|
<record model="ir.ui.view" id="dimension_ass_view_list">
|
||||||
|
<field name="model">analytic.dimension.assignment</field>
|
||||||
|
<field name="type">tree</field>
|
||||||
|
<field name="name">dimension_ass_tree</field>
|
||||||
|
</record>
|
||||||
|
</data>
|
||||||
|
</tryton>
|
||||||
@@ -269,6 +269,11 @@ class Purchase(metaclass=PoolMeta):
|
|||||||
doc_template = fields.Many2One('doc.template',"Template")
|
doc_template = fields.Many2One('doc.template',"Template")
|
||||||
required_documents = fields.Many2Many(
|
required_documents = fields.Many2Many(
|
||||||
'contract.document.type', 'purchase', 'doc_type', 'Required Documents')
|
'contract.document.type', 'purchase', 'doc_type', 'Required Documents')
|
||||||
|
analytic_dimensions = fields.One2Many(
|
||||||
|
'analytic.dimension.assignment',
|
||||||
|
'purchase',
|
||||||
|
'Analytic Dimensions'
|
||||||
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def default_viewer(cls):
|
def default_viewer(cls):
|
||||||
|
|||||||
@@ -30,4 +30,5 @@ xml:
|
|||||||
global_reporting.xml
|
global_reporting.xml
|
||||||
derivative.xml
|
derivative.xml
|
||||||
valuation.xml
|
valuation.xml
|
||||||
weight_report.xml
|
weight_report.xml
|
||||||
|
dimension.xml
|
||||||
6
modules/purchase_trade/view/dimension_ass_form.xml
Normal file
6
modules/purchase_trade/view/dimension_ass_form.xml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<form>
|
||||||
|
<label name="dimension"/>
|
||||||
|
<field name="dimension"/>
|
||||||
|
<label name="value"/>
|
||||||
|
<field name="value"/>
|
||||||
|
</form>
|
||||||
4
modules/purchase_trade/view/dimension_ass_tree.xml
Normal file
4
modules/purchase_trade/view/dimension_ass_tree.xml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<tree editable="1">
|
||||||
|
<field name="dimension"/>
|
||||||
|
<field name="value"/>
|
||||||
|
</tree>
|
||||||
8
modules/purchase_trade/view/dimension_form.xml
Normal file
8
modules/purchase_trade/view/dimension_form.xml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<form>
|
||||||
|
<label name="name"/>
|
||||||
|
<field name="name"/>
|
||||||
|
<label name="code"/>
|
||||||
|
<field name="code"/>
|
||||||
|
<label name="active"/>
|
||||||
|
<field name="active"/>
|
||||||
|
</form>
|
||||||
5
modules/purchase_trade/view/dimension_tree.xml
Normal file
5
modules/purchase_trade/view/dimension_tree.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<tree>
|
||||||
|
<field name="name"/>
|
||||||
|
<field name="code"/>
|
||||||
|
<field name="active"/>
|
||||||
|
</tree>
|
||||||
14
modules/purchase_trade/view/dimension_value_form.xml
Normal file
14
modules/purchase_trade/view/dimension_value_form.xml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<form col="4">
|
||||||
|
<label name="dimension"/>
|
||||||
|
<field name="dimension"/>
|
||||||
|
<label name="name"/>
|
||||||
|
<field name="name"/>
|
||||||
|
<label name="code"/>
|
||||||
|
<field name="code"/>
|
||||||
|
<label name="parent"/>
|
||||||
|
<field name="parent"/>
|
||||||
|
<label name="active"/>
|
||||||
|
<field name="active"/>
|
||||||
|
<newline/>
|
||||||
|
<field name="children" colspan="4"/>
|
||||||
|
</form>
|
||||||
7
modules/purchase_trade/view/dimension_value_tree.xml
Normal file
7
modules/purchase_trade/view/dimension_value_tree.xml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<tree editable="1">
|
||||||
|
<field name="dimension"/>
|
||||||
|
<field name="name"/>
|
||||||
|
<field name="code"/>
|
||||||
|
<field name="parent"/>
|
||||||
|
<field name="active"/>
|
||||||
|
</tree>
|
||||||
@@ -59,5 +59,8 @@ this repository contains the full copyright notices and license terms. -->
|
|||||||
<newline/>
|
<newline/>
|
||||||
<field name="required_documents" colspan="4"/>
|
<field name="required_documents" colspan="4"/>
|
||||||
</page>
|
</page>
|
||||||
|
<page string="Dimensions" id="di">
|
||||||
|
<field name="analytic_dimensions" colspan="4"/>
|
||||||
|
</page>
|
||||||
</xpath>
|
</xpath>
|
||||||
</data>
|
</data>
|
||||||
Reference in New Issue
Block a user