From a00de91001c10aa14cdb84523b676c3d12bf45a2 Mon Sep 17 00:00:00 2001 From: Antonio Esposito Date: Mon, 27 Oct 2014 13:00:18 +0100 Subject: [PATCH] [FIX] hr_timesheet_invoice: warning in report generation When generating the report 'Timesheet Profit', got a warning "The domain term '('user_id', '=', [...])' should use the 'in' or 'not in' operator." This warning is due to the use of the '=' operator to compare the field 'user_id' while the reports sends a list of ids. Fallback to still accept a single id in case of customised reports. --- addons/hr_timesheet_invoice/report/account_analytic_profit.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/hr_timesheet_invoice/report/account_analytic_profit.py b/addons/hr_timesheet_invoice/report/account_analytic_profit.py index 57fd06b0c34..dfdce39a9d9 100644 --- a/addons/hr_timesheet_invoice/report/account_analytic_profit.py +++ b/addons/hr_timesheet_invoice/report/account_analytic_profit.py @@ -37,13 +37,15 @@ class account_analytic_profit(report_sxw.rml_parse): return user_obj.browse(self.cr, self.uid, ids) def _journal_ids(self, form, user_id): + if isinstance(user_id, (int, long)): + user_id = [user_id] line_obj=pooler.get_pool(self.cr.dbname).get('account.analytic.line') journal_obj=pooler.get_pool(self.cr.dbname).get('account.analytic.journal') line_ids=line_obj.search(self.cr, self.uid, [ ('date', '>=', form['date_from']), ('date', '<=', form['date_to']), ('journal_id', 'in', form['journal_ids'][0][2]), - ('user_id', '=', user_id), + ('user_id', 'in', user_id), ]) ids=list(set([b.journal_id.id for b in line_obj.browse(self.cr, self.uid, line_ids)])) return journal_obj.browse(self.cr, self.uid, ids)