跳至内容
菜单
此问题已终结
3 回复
22007 查看

Hello,

Is it possible to add a calculated measure to graph and pivot view?

For example in Sale Order Tree View i click on Group by --> Partner.
In the Pivot i see the measures "Amount Untaxed" and "Amount Total". In these two columns i see the two totals for each partner.
I want to add the Measure ("Amount Total" - "Amount Untaxed").

So, if with the partner "Agrolait" the sum of Amount Total is 100$ and the sum of Amount Untaxed is 80$ i want to see in the other column the value 20$

 i don't want to create a new field. In my example 100$ and 80$ are not the value of the field "Amount Total" and "Amount Untaxed" of one record but is the sum of the values of more records given by group_operator=sum ​

Thanks

形象
丢弃
最佳答案

Hi!

Yes, it possible.

1- First, create the field with the computed value (don't forget to create the method _compute_amount_diff)

amount_diff = fields.Float("Amoun Diff.", compute='_compute_amount_diff', compute_sudo=True, store=True, digits=(12, 6), readonly=True)

2- Second, add the field in your XML view

<pivot string="Sales Orders">
<field name="amount_diff" type="measure"/>
</pivot>

Best regards!

形象
丢弃
最佳答案

We have a module developed for this, please let me know if you need help in this regard.

形象
丢弃

Can you elaborate on this module? Can we test it somewhere?

Hi,

 

Using this module you can create any new formula field in any existing pivot table and add the view to favorites, we don’t have its demo anywhere setup but I can send you a small video if you want to.

 

We also have another module using that you can create new pivot table with drag and drop.

 


Thanks

Faisal Siddiqui

CTO

www.intelliVersal.com

Skype ID: intelliVersal

Cell/WhatsApp: +92 333 228 3797

 

From: Xavier Boes <notifications@mail.odoo.com>
Sent: Friday, May 20, 2022 2:32 PM
To: intelliVersal Integrated Solutions <faisal@intelliversal.com>
Subject: Re: Calculated Measure in Pivot and Graph View

 

Can you elaborate on this module? Can we test it somewhere?

Verzonden door Odoo S.A. gebruikende Odoo.

编写者 最佳答案

Hi!

Thanks for the answer but i don't want to create a field. In my example 100$ and 80$ are not the value of the field "Amount Total" and "Amount Untaxed" but is the sum of the values of more records given by group_operator=sum

形象
丢弃
相关帖文 回复 查看 活动
1
10月 20
17262
2
7月 24
2366
2
5月 24
3431
1
2月 24
1910
1
11月 22
5733