From 4e137f8ff22ffc1810043822c23e5b08769b04fb Mon Sep 17 00:00:00 2001 From: Ankita Raval Date: Wed, 25 Mar 2020 13:46:38 +0000 Subject: [PATCH] [FIX] account: fix ambigius issue. In this commit,we add a proper reference on credit and debit because we are referencing an attribute or attributes that belong to more than one of the tables we are using in the query, and have not qualified the attribute reference. closes odoo/odoo#48796 X-original-commit: 9de090926390e2f02dea979347b477e31bc9188f Signed-off-by: Christophe Simonis Signed-off-by: Nicolas Martinelli (nim) --- addons/account/models/account_move.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 7f2e9577569..1f5f8efeb14 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -1488,7 +1488,7 @@ class AccountMove(models.Model): self.env['account.move.line'].flush(self.env['account.move.line']._fields) self.env['account.move'].flush(['journal_id']) self._cr.execute(''' - SELECT line.move_id, ROUND(SUM(debit - credit), currency.decimal_places) + SELECT line.move_id, ROUND(SUM(line.debit - line.credit), currency.decimal_places) FROM account_move_line line JOIN account_move move ON move.id = line.move_id JOIN account_journal journal ON journal.id = move.journal_id @@ -1496,7 +1496,7 @@ class AccountMove(models.Model): JOIN res_currency currency ON currency.id = company.currency_id WHERE line.move_id IN %s GROUP BY line.move_id, currency.decimal_places - HAVING ROUND(SUM(debit - credit), currency.decimal_places) != 0.0; + HAVING ROUND(SUM(line.debit - line.credit), currency.decimal_places) != 0.0; ''', [tuple(self.ids)]) query_res = self._cr.fetchall()