This question has been flagged
3 Replies
18072 Views

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

Avatar
Discard
Best Answer

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!

Avatar
Discard
Best Answer

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

Avatar
Discard

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.

Author Best Answer

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

Avatar
Discard