[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) <qdp@openerp.com>
This commit is contained in:
@@ -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))]
|
||||
|
||||
Reference in New Issue
Block a user