Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
1978 มุมมอง

I need to sum the total quantity of several products by id, I have achieved only that the total quantity of all products in general is added, but I need to sum product by product and then show the total quantity of product 1 and the total quantity of product 2 and so on

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi,

You can use read_group function to achieve this

Example

order_line.read_group([], ["quantity", "product_id"], ["product_id"])

Regards

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
พ.ค. 23
1890
Get the values of one2many field แก้ไขแล้ว
1
มิ.ย. 22
2459
1
มิ.ย. 22
1574
1
เม.ย. 24
1333
1
ต.ค. 23
1467