There's more...

Grouping on date fields can be complicated because it is possible to group records based on days, weeks, quarters, months, or years. You can change the grouping behavior of the date field by passing the groupby_function after : in the groupby parameter. If you want to group the monthly total of the sales orders, you can use the read_group method:

self.env['sale.order'].read_group([], ['total:sum(amount_total)'], ['order_date:month'])
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset