Fill in payment's invoice field in workflow_to_end. This fixes the test.

This commit is contained in:
Albert Cervera i Areny 2020-11-28 00:21:48 +01:00
parent 2efd7155c3
commit 8a72254f8d

View File

@ -102,7 +102,7 @@ class Sale(metaclass=PoolMeta):
if to_post: if to_post:
Invoice.post(to_post) Invoice.post(to_post)
to_write = [] to_save = []
to_do = [] to_do = []
for sale in sales: for sale in sales:
posted_invoice = None posted_invoice = None
@ -118,13 +118,13 @@ class Sale(metaclass=PoolMeta):
# and both parties must be the same # and both parties must be the same
if payment.party != invoice.party: if payment.party != invoice.party:
payment.party = invoice.party payment.party = invoice.party
to_write.extend(([payment], payment._save_values)) payment.invoice = posted_invoice
to_save.append(payment)
if sale.is_done(): if sale.is_done():
to_do.append(sale) to_do.append(sale)
if to_write: StatementLine.save(to_save)
StatementLine.write(*to_write)
if to_do: if to_do:
cls.do(to_do) cls.do(to_do)