I was thinking in something like the code below: 

In Report

    with Transaction().set_context(_check_access=False):
        date = data['date']
        department = data['deparment']

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.

Thusday, January 31 2018, 6:54:27 (UTC-6), Sergi Almacellas Abellana escribió:
> El 31/01/18 a les 13:04, Josias Pérez ha escrit:
> > So, I want to group these result to show only 
> > 
> > Group 1   45 (which is the expected behavior), dates are not required in 
> > the report.
> > 
> > I was thinking in add the method set_context to the report and send it to 
> > the table_query. In a table_query, without report, using an aditional class 
> > 'deparment.context' it works fine and give the expected results. 
> > 
> > Any help will be appreciated. 
> I think the better option is to create two diferents table_queries with
> different group bys. And then on your report just use the one you want.
> 
> In order to simplify the code, you can use a Mixin as done in the
> oportunity module:
> 
> http://hg.tryton.org/modules/sale_opportunity/file/e65684f7ecbd/opportunity.py#l520
> 
> Hope it helps.
> 
> -- 
> 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/5c1faacf-a1db-46fe-a98a-a211946ba838%40googlegroups.com.

Reply via email to