changeset 8fac6f7c59cf in modules/production_work:default
details:
https://hg.tryton.org/modules/production_work?cmd=changeset&node=8fac6f7c59cf
description:
Send only the required fields when fetching a readonly view definition
issue11134
review380081002
diffstat:
production.py | 6 ++----
work.py | 24 ++++++++----------------
2 files changed, 10 insertions(+), 20 deletions(-)
diffs (96 lines):
diff -r d2f1b7710d59 -r 8fac6f7c59cf production.py
--- a/production.py Wed Apr 06 23:37:43 2022 +0200
+++ b/production.py Fri Apr 08 19:07:13 2022 +0200
@@ -25,8 +25,7 @@
domain=[
('company', '=', Eval('company', -1)),
('warehouse', '=', Eval('warehouse', -1)),
- ],
- depends=['routing', 'company', 'warehouse', 'state'])
+ ])
works = fields.One2Many('production.work', 'production', 'Works',
states={
'readonly': Eval('state').in_(
@@ -34,8 +33,7 @@
},
domain=[
('company', '=', Eval('company', -1)),
- ],
- depends=['state', 'company'])
+ ])
def get_cost(self, name):
pool = Pool()
diff -r d2f1b7710d59 -r 8fac6f7c59cf work.py
--- a/work.py Wed Apr 06 23:37:43 2022 +0200
+++ b/work.py Fri Apr 08 19:07:13 2022 +0200
@@ -32,20 +32,17 @@
domain=[
('company', '=', Eval('company', -1)),
('warehouse', '=', Eval('warehouse', -1)),
- ],
- depends=['company', 'warehouse'])
+ ])
children = fields.One2Many('production.work.center', 'parent', 'Children',
domain=[
('company', '=', Eval('company', -1)),
('warehouse', '=', Eval('warehouse', -1)),
- ],
- depends=['company', 'warehouse'])
+ ])
category = fields.Many2One('production.work.center.category', 'Category')
cost_price = fields.Numeric('Cost Price', digits=price_digits,
states={
'required': Bool(Eval('cost_method')),
- },
- depends=['cost_method'])
+ })
cost_method = fields.Selection([
('', ''),
('cycle', 'Per Cycle'),
@@ -53,8 +50,7 @@
], 'Cost Method',
states={
'required': Bool(Eval('cost_price')),
- },
- depends=['cost_price'])
+ })
company = fields.Many2One('company.company', 'Company', required=True,
select=True)
warehouse = fields.Many2One('stock.location', 'Warehouse', required=True,
@@ -108,8 +104,7 @@
select=True, ondelete='CASCADE',
domain=[
('company', '=', Eval('company', -1)),
- ],
- depends=['company'])
+ ])
work_center_category = fields.Function(fields.Many2One(
'production.work.center.category', 'Work Center Category'),
'on_change_with_work_center_category')
@@ -123,13 +118,11 @@
],
states={
'required': ~Eval('state').in_(['request', 'draft']),
- },
- depends=['work_center_category', 'company', 'warehouse', 'state'])
+ })
cycles = fields.One2Many('production.work.cycle', 'work', 'Cycles',
states={
'readonly': Eval('state').in_(['request', 'done']),
- },
- depends=['state'])
+ })
active_cycles = fields.One2Many(
'production.work.cycle', 'work', "Active Cycles",
readonly=True,
@@ -283,8 +276,7 @@
states={
'required': Eval('state') == 'done',
'readonly': Eval('state').in_(['done', 'draft', 'cancelled']),
- },
- depends=['state'])
+ })
cost = fields.Numeric('Cost', digits=price_digits, readonly=True)
state = fields.Selection([
('draft', 'Draft'),