From f7c64e7bd58ab70f1e51de74afc11dc838043d92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20=C3=89vrard?= Date: Fri, 8 Apr 2022 19:07:14 +0200 Subject: [PATCH] Send only the required fields when fetching a readonly view definition issue11134 review380081002 --- stock.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/stock.py b/stock.py index b25d450b5f..959ccbd93b 100644 --- a/stock.py +++ b/stock.py @@ -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):