From 2337d4115bc53fd8be574480dcf432283432bd78 Mon Sep 17 00:00:00 2001 From: qdp-odoo Date: Wed, 3 Jul 2019 21:47:55 +0000 Subject: [PATCH] [FIX] sale: traceback in sales team dashboard * Sales > Orders > Sales Team > traceback with error 'user_type_id' isn't defined on account.move.line. * Also the move.team_id has to appear in some group by because we're using an aggregate function. Both bugs have been introduced by beaa30a (aka accounting-pocalypse) closes odoo/odoo#34570 Signed-off-by: Quentin De Paoli (qdp) --- addons/sale/models/sales_team.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/sale/models/sales_team.py b/addons/sale/models/sales_team.py index 280b6d0a3ad..d0a16ecc1b7 100644 --- a/addons/sale/models/sales_team.py +++ b/addons/sale/models/sales_team.py @@ -74,7 +74,6 @@ class CrmTeam(models.Model): SUM(line.balance) AS amount_untaxed_signed FROM account_move move LEFT JOIN account_move_line line ON line.move_id = move.id - INNER JOIN account_account_type account_type ON account_type.id = line.user_type_id WHERE move.type IN ('out_invoice', 'out_refund', 'in_invoice', 'in_refund') AND move.invoice_payment_state IN ('in_payment', 'paid') AND move.state = 'posted' @@ -82,7 +81,8 @@ class CrmTeam(models.Model): AND move.date BETWEEN %s AND %s AND line.tax_line_id IS NULL AND line.display_type IS NULL - AND account_type.type NOT IN ('receivable', 'payable') + AND line.account_internal_type NOT IN ('receivable', 'payable') + GROUP BY move.team_id ''' today = fields.Date.today() params = [tuple(self.ids), fields.Date.to_string(today), fields.Date.to_string(today.replace(day=1))]