On 2017-03-17 12:38, Khurram Shahzad wrote:
> Dear All,
> 
> I want to create a report which will show the summary of sales grouped by
> the product category. The user will input the date range i.e. 'Date From'
> and 'Date To'.
> 
> I have tried to use the search method of model but I think it does not
> support the 'group by' clause. Any ideas or best practices of achieving
> this?

Create a ModelSQL with a custom table_query [1] like that you will be
free to use the full features of SQL to make your group by.
Also for Date encoding, you can use the new context_model on
ir.action.act_window to get fast responsiveness to change dates.

An example of that is the GeneralLedger report:
http://hg.tryton.org/modules/account/file/3f86af1e9ebd/account.py#l1197


[1] 
http://doc.tryton.org/4.2/trytond/doc/ref/models/models.html?highlight=table_query#trytond.model.ModelSQL.table_query

-- 
Cédric Krier - B2CK SPRL
Email/Jabber: [email protected]
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/

-- 
You received this message because you are subscribed to the Google Groups 
"tryton" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton/20170317081054.GE43953%40tetsuo.

Reply via email to