Skip to Content
Menu
This question has been flagged
2 Replies
3172 Views

please help me below query working fine it gives monthly group with amount but I need group by day  not monthly in odoo11. how to build i query group by day with amount

this query under reports.py file with in models.AbstractModel

self.env['account.invoice'].read_group([],['date_invoice','amount_total'],['date_invoice']) 

for group in groups:
print(group['date_invoice'],group['amount_total'])

November 2016      xyz amount
December 2016      4525.52
January 2017          4525.23
February 2017         122.78
March 2017              10159.24

Avatar
Discard
Best Answer

>>> groups= self.env['account.invoice'].read_group([], ['date_invoice','amount_total'], ['date_invoice:day'])
>>> for group in groups:
... print('>>>', group['date_invoice:day'], group['amount_total'])
...
>>> 01 Jan 2020 14640.0
>>> 07 Jan 2020 4610.0
>>> 08 Jan 2020 1275.0
>>> 15 Jan 2020 5749.99
>>> False 0.0
>>>

Avatar
Discard
Best Answer

Hello,

Try to add ['date_order:day'] into field group by parameter. 

This may help.

Avatar
Discard