From aa09c522053b8c91dea557f9e9e71be2f4e965be Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Tue, 27 Dec 2016 21:02:14 +0100 Subject: [PATCH] [FIX] account: correct query fix up of commit e98c3290396b646447b3abc9c13e72811cbeb286. opw:702908 opw:702909 opw:702910 opw:702911 opw:702918 --- addons/account/models/partner.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/account/models/partner.py b/addons/account/models/partner.py index 92d539c8679..bb78919c767 100644 --- a/addons/account/models/partner.py +++ b/addons/account/models/partner.py @@ -234,6 +234,8 @@ class ResPartner(models.Model): def _credit_debit_get(self): tables, where_clause, where_params = self.env['account.move.line']._query_get() where_params = [tuple(self.ids)] + where_params + if where_clause: + where_clause = 'AND ' + where_clause self._cr.execute("""SELECT account_move_line.partner_id, act.type, SUM(account_move_line.amount_residual) FROM account_move_line LEFT JOIN account_account a ON (account_move_line.account_id=a.id) @@ -241,7 +243,7 @@ class ResPartner(models.Model): WHERE act.type IN ('receivable','payable') AND account_move_line.partner_id IN %s AND account_move_line.reconciled IS FALSE - AND """ + where_clause + """ + """ + where_clause + """ GROUP BY account_move_line.partner_id, act.type """, where_params) for pid, type, val in self._cr.fetchall():