From aa00c30c18cf1d2cf50591d9301499a1bbe2a2f1 Mon Sep 17 00:00:00 2001 From: Adrien Widart Date: Thu, 19 Nov 2020 15:20:05 +0000 Subject: [PATCH] [FIX] account_check_printing: print check of payment group When some bills are not paid, some with due date, some without, when registering the payment of these bills as a group payment with checks, it is not possible to print the check To reproduce the error: (Need account) 1. Go to Invoicing > Vendors > Bills 2. Create a new one - Add at least one line - Add the Payment Terms 3. Save & Post 4. Duplicate it, then Save & Post 5. Go back to Bills 6. Select the two bills 7. Click on Action > Register Payment 8. Select Checks, enable Group Payment 9. Click on Create Payment 10. Click on Print Check 11. Click on Print => An Odoo Error is raised The user should be able to print it. OPW-2389368 closes odoo/odoo#62391 X-original-commit: 4dc4dc3d20114bea54266d97de29565a1a1ac230 Signed-off-by: adwid --- addons/account_check_printing/models/account_payment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account_check_printing/models/account_payment.py b/addons/account_check_printing/models/account_payment.py index 555fd9b60a4..12a75b14980 100644 --- a/addons/account_check_printing/models/account_payment.py +++ b/addons/account_check_printing/models/account_payment.py @@ -206,7 +206,7 @@ class AccountPayment(models.Model): multi_stub = self.company_id.account_check_printing_multi_stub - invoices = self.move_id._get_reconciled_invoices().sorted(key=lambda r: r.invoice_date_due) + invoices = self.move_id._get_reconciled_invoices().sorted(key=lambda r: r.invoice_date_due or fields.Date.context_today(self)) debits = invoices.filtered(lambda r: r.move_type == 'in_invoice') credits = invoices.filtered(lambda r: r.move_type == 'in_refund')