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


Pivot view Header and sub level (Product) Header Total value replace with custom formula. Example: Sub Level  Total value = (price * qty) = Product1 = Product 2 to product n

                 And Total Header value = (price * qty) product1 + (price * qty) product to product n

Please see the below image.

https://postimg.cc/xJWp54wC

Sub Level total customized read_group method override and formula price * qty applied.

But Pivot view header total not get expected output. please check the below code.


@api.model
def read_group
(self, domain, fields, groupby, offset=0, limit=None, orderby=False, lazy=True):
res = super(productreport, self).read_group(domain, fields, groupby, offset=offset, limit=limit, orderby=orderby, lazy=lazy)
for line in res:
if 'price_unit' in line and 'qty' in line and not 'id' in line:
line['price_total'] = line['price_unit'] * line['qty']
return res


Please let me know pivot header total value how to update customize formula.



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

Same problem, you found solution for this problem ?

อวตาร
ละทิ้ง
ผู้เขียน

No found solution, It seems current pivot report screenshot is right, Header value cannot change. C Column multiplying A*B and header column may be Total or Average

@Prakash u can print line to check line not id and modify code for properly

Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ก.ค. 25
2323
2
ก.ค. 25
7803
2
ก.ค. 25
4205
2
ก.ค. 25
3989
2
มิ.ย. 25
2589