details: https://code.tryton.org/tryton/commit/bc9b43e84e3c
branch: 7.0
user: Cédric Krier <[email protected]>
date: Wed Jul 22 12:28:03 2026 +0200
description:
Make statement lines readonly when origins are filled
Closes #14965
(grafted from ad46e99cf76bee15373625a6ea0ec4e57a58ff06)
diffstat:
modules/account_statement/statement.py | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diffs (32 lines):
diff -r a1fbd79aeb3b -r bc9b43e84e3c modules/account_statement/statement.py
--- a/modules/account_statement/statement.py Thu Jun 11 21:30:46 2026 +0200
+++ b/modules/account_statement/statement.py Wed Jul 22 12:28:03 2026 +0200
@@ -101,7 +101,10 @@
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 @@
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: