Skip to Content
Menu
This question has been flagged
1 Reply
15236 Views


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
Discard
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
Discard
Related Posts Replies Views Activity
3
Oct 23
19778
2
Jul 24
422
2
May 24
385
1
Feb 24
319
1
Nov 22
3394