El 31/01/18 a les 15:33, Josias Pérez ha escrit: > I was thinking in something like the code below: > > In Report > > with Transaction().set_context(_check_access=False): > date = data['date'] > department = data['deparment']
Then you should have to surround the search with the set_context call: with Transaction().set_context( date=data['date'], department=data['department']): records = Model.search(domain) > > In table_query > if Transaction().context.get('date'): > where &= report.date >= Transaction().context['date'] > if Transaction().context.get('department'): > where &= report_line.department == Transaction().context['deparment'] > > But I dont know if it is possible or a good practice. Indeed the table query can be directly searched so you be able to perform the following search on your get_records method: records = Model.search([ ('date', '>=', data['date']), ('department', '=', data['department']), ]) For me this is the cleaner solution. -- Sergi Almacellas Abellana www.koolpi.com Twitter: @pokoli_srk -- You received this message because you are subscribed to the Google Groups "tryton-dev" group. To view this discussion on the web visit https://groups.google.com/d/msgid/tryton-dev/13a9c499-ad11-02b1-deb0-de0557019797%40koolpi.com.