changeset 7b42dfdc452d in modules/production:default
details:
https://hg.tryton.org/modules/production?cmd=changeset&node=7b42dfdc452d
description:
Send only the required fields when fetching a readonly view definition
issue11134
review380081002
diffstat:
bom.py | 6 +++---
configuration.py | 3 +--
product.py | 12 ++++--------
production.py | 41 ++++++++++++++---------------------------
stock.py | 14 ++++----------
5 files changed, 26 insertions(+), 50 deletions(-)
diffs (268 lines):
diff -r 8e55d7349980 -r 7b42dfdc452d bom.py
--- a/bom.py Wed Apr 06 23:37:43 2022 +0200
+++ b/bom.py Fri Apr 08 19:07:13 2022 +0200
@@ -53,7 +53,7 @@
uom = fields.Many2One('product.uom', 'Uom', required=True,
domain=[
('category', '=', Eval('uom_category')),
- ], depends=['uom_category'])
+ ])
quantity = fields.Float('Quantity', digits='uom', required=True,
domain=['OR',
('quantity', '>=', 0),
@@ -190,13 +190,13 @@
uom = fields.Many2One('product.uom', 'Unit', required=True,
domain=[
('category', '=', Eval('category')),
- ], depends=['category'])
+ ])
category = fields.Many2One('product.uom.category', 'Category',
readonly=True)
bom = fields.Many2One('product.product-production.bom',
'BOM', required=True, domain=[
('product', '=', Eval('product')),
- ], depends=['product'])
+ ])
product = fields.Many2One('product.product', 'Product', readonly=True)
diff -r 8e55d7349980 -r 7b42dfdc452d configuration.py
--- a/configuration.py Wed Apr 06 23:37:43 2022 +0200
+++ b/configuration.py Fri Apr 08 19:07:13 2022 +0200
@@ -38,8 +38,7 @@
('company', 'in', [Eval('company', -1), None]),
('sequence_type', '=',
Id('production', 'sequence_type_production')),
- ],
- depends=['company'])
+ ])
@classmethod
def __register__(cls, module_name):
diff -r 8e55d7349980 -r 7b42dfdc452d product.py
--- a/product.py Wed Apr 06 23:37:43 2022 +0200
+++ b/product.py Fri Apr 08 19:07:13 2022 +0200
@@ -18,7 +18,6 @@
cls.producible.states = {
'invisible': ~Eval('type').in_(cls.get_producible_types()),
}
- cls.producible.depends = ['type']
@classmethod
def get_producible_types(cls):
@@ -39,14 +38,12 @@
'BOMs', order=[('sequence', 'ASC'), ('id', 'ASC')],
states={
'invisible': ~Eval('producible')
- },
- depends=['producible'])
+ })
lead_times = fields.One2Many('production.lead_time',
'product', 'Lead Times', order=[('sequence', 'ASC'), ('id', 'ASC')],
states={
'invisible': ~Eval('producible'),
- },
- depends=['producible'])
+ })
@classmethod
def validate(cls, products):
@@ -93,7 +90,7 @@
('output_products', '=', If(Bool(Eval('product')),
Eval('product', 0),
Get(Eval('_parent_product', {}), 'id', 0))),
- ], depends=['product'])
+ ])
def get_rec_name(self, name):
return self.bom.rec_name
@@ -117,8 +114,7 @@
('output_products', '=', If(Bool(Eval('product')),
Eval('product', -1),
Get(Eval('_parent_product', {}), 'id', 0))),
- ],
- depends=['product'])
+ ])
lead_time = fields.TimeDelta('Lead Time')
@classmethod
diff -r 8e55d7349980 -r 7b42dfdc452d production.py
--- a/production.py Wed Apr 06 23:37:43 2022 +0200
+++ b/production.py Fri Apr 08 19:07:13 2022 +0200
@@ -32,34 +32,28 @@
reference = fields.Char('Reference', select=1,
states={
'readonly': ~Eval('state').in_(['request', 'draft']),
- },
- depends=['state'])
+ })
planned_date = fields.Date('Planned Date',
states={
'readonly': ~Eval('state').in_(['request', 'draft']),
- },
- depends=['state'])
+ })
effective_date = fields.Date('Effective Date',
states={
'readonly': Eval('state').in_(['cancelled', 'done']),
- },
- depends=['state'])
+ })
planned_start_date = fields.Date('Planned Start Date',
states={
'readonly': ~Eval('state').in_(['request', 'draft']),
'required': Bool(Eval('planned_date')),
- },
- depends=['state', 'planned_date'])
+ })
effective_start_date = fields.Date('Effective Start Date',
states={
'readonly': Eval('state').in_(['cancelled', 'running', 'done']),
- },
- depends=['state'])
+ })
company = fields.Many2One('company.company', 'Company', required=True,
states={
'readonly': ~Eval('state').in_(['request', 'draft']),
- },
- depends=['state'])
+ })
warehouse = fields.Many2One('stock.location', 'Warehouse', required=True,
domain=[
('type', '=', 'warehouse'),
@@ -67,8 +61,7 @@
states={
'readonly': (~Eval('state').in_(['request', 'draft'])
| Eval('inputs', [-1]) | Eval('outputs', [-1])),
- },
- depends=['state'])
+ })
location = fields.Many2One('stock.location', 'Location', required=True,
domain=[
('type', '=', 'production'),
@@ -76,8 +69,7 @@
states={
'readonly': (~Eval('state').in_(['request', 'draft'])
| Eval('inputs', [-1]) | Eval('outputs', [-1])),
- },
- depends=['state'])
+ })
product = fields.Many2One('product.product', 'Product',
domain=[
('producible', '=', True),
@@ -88,7 +80,7 @@
context={
'company': Eval('company', -1),
},
- depends=['company'])
+ depends={'company'})
bom = fields.Many2One('production.bom', 'BOM',
domain=[
('output_products', '=', Eval('product', 0)),
@@ -97,8 +89,7 @@
'readonly': (~Eval('state').in_(['request', 'draft'])
| ~Eval('warehouse', 0) | ~Eval('location', 0)),
'invisible': ~Eval('product'),
- },
- depends=['product'])
+ })
uom_category = fields.Function(fields.Many2One(
'product.uom.category', 'Uom Category'),
'on_change_with_uom_category')
@@ -110,8 +101,7 @@
'readonly': ~Eval('state').in_(['request', 'draft']),
'required': Bool(Eval('bom')),
'invisible': ~Eval('product'),
- },
- depends=['uom_category'])
+ })
quantity = fields.Float(
"Quantity", digits='uom',
states={
@@ -131,8 +121,7 @@
states={
'readonly': (~Eval('state').in_(['request', 'draft', 'waiting'])
| ~Eval('warehouse') | ~Eval('location')),
- },
- depends=['warehouse', 'location', 'company'])
+ })
outputs = fields.One2Many('stock.move', 'production_output', 'Outputs',
domain=[
('shipment', '=', None),
@@ -146,8 +135,7 @@
states={
'readonly': (Eval('state').in_(['done', 'cancelled'])
| ~Eval('warehouse') | ~Eval('location')),
- },
- depends=['warehouse', 'location', 'company'])
+ })
assigned_by = employee_field("Assigned By")
run_by = employee_field("Run By")
@@ -165,8 +153,7 @@
"Origin", selection='get_origin', select=True,
states={
'readonly': ~Eval('state').in_(['request', 'draft']),
- },
- depends=['state'])
+ })
@classmethod
def __setup__(cls):
diff -r 8e55d7349980 -r 7b42dfdc452d stock.py
--- a/stock.py Wed Apr 06 23:37:43 2022 +0200
+++ b/stock.py Fri Apr 08 19:07:13 2022 +0200
@@ -16,8 +16,7 @@
},
domain=[
('type', '=', 'production'),
- ],
- depends=['type'])
+ ])
production_picking_location = fields.Many2One(
'stock.location', "Production Picking",
states={
@@ -27,7 +26,6 @@
('type', '=', 'storage'),
('parent', 'child_of', [Eval('id', -1)]),
],
- depends=['type', 'id'],
help="Where the production components are picked from.\n"
"Leave empty to use the warehouse storage location.")
production_output_location = fields.Many2One(
@@ -39,7 +37,6 @@
('type', '=', 'storage'),
('parent', 'child_of', [Eval('id', -1)]),
],
- depends=['type', 'id'],
help="Where the produced goods are stored.\n"
"Leave empty to use the warehouse storage location.")
@@ -51,15 +48,13 @@
domain=[('company', '=', Eval('company'))],
states={
'invisible': ~Eval('production_input'),
- },
- depends=['company'])
+ })
production_output = fields.Many2One('production', 'Production Output',
readonly=True, select=True, ondelete='CASCADE',
domain=[('company', '=', Eval('company'))],
states={
'invisible': ~Eval('production_output'),
- },
- depends=['company'])
+ })
production = fields.Function(fields.Many2One(
'production', "Production",
states={
@@ -70,8 +65,7 @@
"Cost Price Updated", readonly=True,
states={
'invisible': ~Eval('production_input') & (Eval('state') == 'done'),
- },
- depends=['production_input', 'state'])
+ })
@classmethod
def __setup__(cls):