[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 <chs@odoo.com>
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
Ankita Raval
2020-04-01 20:49:41 +00:00
parent 4b7ac65e17
commit 4e137f8ff2
+2 -2
View File
@@ -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()