[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) <lpe@odoo.com>
This commit is contained in:
Lucas Perais (lpe)
2019-04-03 13:24:59 +00:00
parent 0539dde576
commit 491deeb3d4
2 changed files with 3 additions and 3 deletions
@@ -42,7 +42,7 @@
</tr>
</thead>
<tbody>
<tr t-foreach="o.invoice_ids" t-as="inv">
<tr t-foreach="o.reconciled_invoice_ids" t-as="inv">
<td><span t-field="inv.date_invoice"/></td>
<td><span t-field="inv.number"/></td>
<td class="text-right"><span t-field="inv.amount_total"/></td>
@@ -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')