diff --git a/modules/account_statement/statement.py b/modules/account_statement/statement.py index 0cabd185c0..3ed1c0c14a 100644 --- a/modules/account_statement/statement.py +++ b/modules/account_statement/statement.py @@ -101,7 +101,10 @@ class Statement(Workflow, ModelSQL, ModelView): states=_number_states) lines = fields.One2Many('account.statement.line', 'statement', 'Lines', states={ - 'readonly': (Eval('state') != 'draft') | ~Eval('journal'), + 'readonly': ( + (Eval('state') != 'draft') + | ~Eval('journal') + | Eval('origins', [])), }) origins = fields.One2Many('account.statement.origin', 'statement', "Origins", states={ @@ -263,11 +266,15 @@ class Statement(Workflow, ModelSQL, ModelView): origin.lines = lines self.origins = origins - @fields.depends('lines') + @fields.depends('lines', 'origins') def on_change_lines(self): pool = Pool() Line = pool.get('account.statement.line') + if self.origins: + # let origin manage the pending amounts + return + invoices = {l.invoice for l in self.lines if l.invoice} invoice_id2amount_to_pay = {} for invoice in invoices: