changeset 04b857ac0c35 in modules/account_statement:default
details:
https://hg.tryton.org/modules/account_statement?cmd=changeset&node=04b857ac0c35
description:
Support alternative payees on invoice
issue11646
review435641003
diffstat:
statement.py | 20 +++++++++++++++-----
1 files changed, 15 insertions(+), 5 deletions(-)
diffs (51 lines):
diff -r 92522a1c18a2 -r 04b857ac0c35 statement.py
--- a/statement.py Tue Aug 02 09:37:51 2022 +0200
+++ b/statement.py Sun Sep 11 17:46:09 2022 +0200
@@ -748,8 +748,11 @@
'account.invoice': [
('company', '=', Eval('company', -1)),
If(Bool(Eval('party')),
- ('party', '=', Eval('party')),
- ()),
+ ['OR',
+ ('party', '=', Eval('party', -1)),
+ ('alternative_payees', '=', Eval('party', -1)),
+ ],
+ []),
If(Bool(Eval('account')),
('account', '=', Eval('account')),
()),
@@ -855,7 +858,8 @@
if self.invoice:
if self.party:
- if self.invoice.party != self.party:
+ if (self.invoice.party != self.party
+ or self.party not in self.invoice.alternative_payees):
self.invoice = None
else:
self.invoice = None
@@ -903,7 +907,13 @@
def on_change_related_to(self):
if self.invoice:
if not self.party:
- self.party = self.invoice.party
+ if not self.invoice.alternative_payees:
+ self.party = self.invoice.party
+ else:
+ try:
+ self.party, = self.invoice.alternative_payees
+ except ValueError:
+ pass
if not self.account:
self.account = self.invoice.account
@@ -985,7 +995,7 @@
to_reconcile.clear()
reconcile_lines = line.invoice.get_reconcile_lines_for_amount(
- move_line.credit - move_line.debit)
+ move_line.credit - move_line.debit, party=line.party)
assert move_line.account == line.invoice.account