From 491deeb3d4227557b15e31b4a8e93022ebb4ff90 Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Wed, 3 Apr 2019 09:04:52 +0000 Subject: [PATCH] [FIX] account, account_check_printing: print all reconciled invoice on a payment Make some invoices Make a payment Reconcile it with the invoices through the reconciliation widget Print the payment receipt and the checks Before this commit, neither the payment receipt nor the checks contained the invoices This was because the prints relied on only the field invoice_ids filled specifically when registering a payment on an invoice After this commit, the prints mention the invoices OPW 1947002 closes odoo/odoo#32365 Signed-off-by: Lucas Perais (lpe) --- addons/account/views/report_payment_receipt_templates.xml | 2 +- addons/account_check_printing/models/account_payment.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/account/views/report_payment_receipt_templates.xml b/addons/account/views/report_payment_receipt_templates.xml index 626cff36fe2..871ae39479f 100644 --- a/addons/account/views/report_payment_receipt_templates.xml +++ b/addons/account/views/report_payment_receipt_templates.xml @@ -42,7 +42,7 @@ - + diff --git a/addons/account_check_printing/models/account_payment.py b/addons/account_check_printing/models/account_payment.py index cfba4270da8..882cf796db0 100644 --- a/addons/account_check_printing/models/account_payment.py +++ b/addons/account_check_printing/models/account_payment.py @@ -151,12 +151,12 @@ class AccountPayment(models.Model): """ The stub is the summary of paid invoices. It may spill on several pages, in which case only the check on first page is valid. This function returns a list of stub lines per page. """ - if len(self.invoice_ids) == 0: + if len(self.reconciled_invoice_ids) == 0: return None multi_stub = self.company_id.account_check_printing_multi_stub - invoices = self.invoice_ids.sorted(key=lambda r: r.date_due) + invoices = self.reconciled_invoice_ids.sorted(key=lambda r: r.date_due) debits = invoices.filtered(lambda r: r.type == 'in_invoice') credits = invoices.filtered(lambda r: r.type == 'in_refund')