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

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
17078
2
7月 24
2179
2
5月 24
2001
1
2月 24
1726
1
11月 22
5485