Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odgovori
17194 Prikazi


Hello,

with this expression:

self.env['sale.order'].read_group([], fields=['partner_id','user_id'], groupby=['partner_id','user_id'])


how can i get the same result of SQL query:

SELECT  partner_id,user_id 
FROM sale_order
GROUP BY partner_id,user_id


In the first expression Odoo doens't group by "user_id" but only by "partner_id"


Odoo11 community

Avatar
Opusti
Best Answer

hi,

Just noticed your case, Try below code

self.env['sale.order'].read_group([], fields=['partner_id','user_id'], groupby=['partner_id','user_id'],lazy=False)

By adding lazy=False will consider your user_id in group by
Avatar
Opusti
Related Posts Odgovori Prikazi Aktivnost
3
okt. 23
21934
2
jul. 24
2299
2
maj 24
2578
1
feb. 24
1818
1
nov. 22
5607