From 8b2c25f5753cbda5e0d37a6dcbd4dde37b7da4ae Mon Sep 17 00:00:00 2001 From: qdp-odoo Date: Thu, 8 Mar 2018 15:16:19 +0100 Subject: [PATCH 1/2] [FIX] account: payment lines of invoices selection The payment lines shown in the payment widget on invoices, should only list reconciliation made towards the lines sharing the same account as the invoice/bill. Previously, if a tax or an invoice line was using another account set reconciliable, any payment made against this account would be shown in the payment widget, which is wrong. OPW: 1805968 --- addons/account/models/account_invoice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index 11b2cf6551a..a22913be9d1 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -188,7 +188,7 @@ class AccountInvoice(models.Model): @api.depends('move_id.line_ids.amount_residual') def _compute_payments(self): payment_lines = [] - for line in self.move_id.line_ids: + for line in self.move_id.line_ids.filtered(lambda l: l.account_id.id == self.account_id.id): payment_lines.extend(filter(None, [rp.credit_move_id.id for rp in line.matched_credit_ids])) payment_lines.extend(filter(None, [rp.debit_move_id.id for rp in line.matched_debit_ids])) self.payment_move_line_ids = self.env['account.move.line'].browse(list(set(payment_lines))) From 7c6da3e076348a386db54a312192b58fffc51984 Mon Sep 17 00:00:00 2001 From: Olivier Colson Date: Fri, 9 Mar 2018 14:12:03 +0100 Subject: [PATCH 2/2] [FIX] account: display partial payments in overdue report Before that, partial payments on open invoices were ignored by the query, due to the fact we used checked "reconciled=false" instead of "full_reconcile_id is not null". --- addons/account/report/account_overdue_report.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/report/account_overdue_report.py b/addons/account/report/account_overdue_report.py index 3aff4821c5e..513e66146d1 100644 --- a/addons/account/report/account_overdue_report.py +++ b/addons/account/report/account_overdue_report.py @@ -25,7 +25,7 @@ class ReportOverdue(models.AbstractModel): "FROM account_move_line l " "JOIN account_account_type at ON (l.user_type_id = at.id) " "JOIN account_move m ON (l.move_id = m.id) " - "WHERE l.partner_id IN %s AND at.type IN ('receivable', 'payable') AND NOT l.reconciled GROUP BY l.date, l.name, l.ref, l.date_maturity, l.partner_id, at.type, l.blocked, l.amount_currency, l.currency_id, l.move_id, m.name", (((fields.date.today(), ) + (tuple(partner_ids),)))) + "WHERE l.partner_id IN %s AND at.type IN ('receivable', 'payable') AND l.full_reconcile_id IS NULL GROUP BY l.date, l.name, l.ref, l.date_maturity, l.partner_id, at.type, l.blocked, l.amount_currency, l.currency_id, l.move_id, m.name", (((fields.date.today(), ) + (tuple(partner_ids),)))) for row in self.env.cr.dictfetchall(): res[row.pop('partner_id')].append(row) return res