[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.
This commit is contained in:
Antonio Esposito 2014-10-27 13:00:18 +01:00 committed by Martin Trigaux
parent 79787084ff
commit a00de91001
1 changed files with 3 additions and 1 deletions

View File

@ -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)