跳至內容
選單
此問題已被標幟
1 回覆
17084 瀏覽次數


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

頭像
捨棄
最佳答案

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
頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
3
10月 23
21835
2
7月 24
2198
2
5月 24
2039
1
2月 24
1734
1
11月 22
5496