From 1ec3fd7cb84349cebd45f78591846bf0f074e195 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 3 Jan 2022 22:39:35 +0100 Subject: [PATCH] Set asset readonly on non draft and simplify invoice_type evaluation issue10998 review385611002 --- invoice.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/invoice.py b/invoice.py index abb0daac65..b3da41d638 100644 --- a/invoice.py +++ b/invoice.py @@ -14,10 +14,12 @@ class InvoiceLine(metaclass=PoolMeta): ], states={ 'invisible': (~Eval('is_assets_depreciable', False) - | (Eval('_parent_invoice', {}).get('type', - Eval('invoice_type')) != 'out')), + | (Eval('invoice_type') != 'out')), + 'readonly': Eval('invoice_state') != 'draft', }, - depends=['product', 'is_assets_depreciable']) + depends=[ + 'product', 'is_assets_depreciable', + 'invoice_state', 'invoice_type']) is_assets_depreciable = fields.Function(fields.Boolean( 'Is Assets depreciable'), 'on_change_with_is_assets_depreciable')