Skip to content
Snippets Groups Projects
Commit 04b857ac authored by Cédric Krier's avatar Cédric Krier :atom:
Browse files

Support alternative payees on invoice

issue11646
review435641003
parent 92522a1c
1 merge request!114Return an empty list when the treeview has no selection
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment