Send only the required fields when fetching a readonly view definition

issue11134
review380081002
This commit is contained in:
Nicolas Évrard committed 2022-04-08 19:07:14 +02:00
1 parent 22b762d769
commit f7c64e7bd5
1 file changed
+3 -7
+3 -7
View File
@@ -30,29 +30,25 @@ class ShipmentCostMixin:
carrier = fields.Many2One('carrier', 'Carrier', states={
'readonly': Eval('state').in_(['done', 'cancelled']),
},
depends=['state'])
})
cost_used = fields.Function(fields.Numeric(
"Cost", digits=price_digits,
states={
'invisible': Eval('cost_edit', False),
},
depends=['cost_edit']),
}),
'on_change_with_cost_used')
cost = fields.Numeric(
"Cost", digits=price_digits,
states={
'invisible': ~Eval('cost_edit', False),
'readonly': Eval('state').in_(['done', 'cancelled']),
},
depends=['state'])
})
cost_edit = fields.Boolean(
"Edit Cost",
states={
'readonly': Eval('state').in_(['done', 'cancelled']),
},
depends=['state'],
help="Check to edit the cost.")
def _get_carrier_context(self):