summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas Perais (lpe) <lpe@odoo.com>2019-04-03 09:04:52 +0000
committerLucas Perais (lpe) <lpe@odoo.com>2019-04-03 13:24:59 +0000
commit491deeb3d4227557b15e31b4a8e93022ebb4ff90 (patch)
tree797ef9369c9e4560cac911322ae1612949456d6f
parent0539dde57671c28c06a79022d98e8bf786d71695 (diff)
[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>
-rw-r--r--addons/account/views/report_payment_receipt_templates.xml2
-rw-r--r--addons/account_check_printing/models/account_payment.py4
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 @@
</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>
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')