Skip to Content
मेन्यू
This question has been flagged
1 Reply
72 Views

Hello, we are implementing Odoo since a couple of months. So still new to some of the tricks. 
Our company is trading in three different currencies, and we have these currencies set up in Accounting/Currencies with their exchange rates.


In the sales module, in pivot view, I can add the "Currency Rate" as a metric, but the displayed numbers are only correct on the level of the individual sales order number. 

Any summary does not show the average of the individual currency rates, but the sum of it. This is not what I need.

If I have 10 Transactions at a 0.8 currency rate, these transaction have a currency rate of 0.8 and not of 8, as it is displayed.

Avatar
Discard
Author

Thanks a lot!

While your solution works, I found an easier option.
I found that after exporting the pivot to a spreadsheet, I get the option to edit the pivot parameters and set "Aggregate by" for the currency rate from "sum" to "average". 
So, for reporting purposes, this works well.
Thank you!

Best Answer

Hi,

You can add a computed stored field on sale.order that represents the currency rate as a float, but tell Odoo to aggregate it as an average in the pivot view.

from odoo import models, fields, api


class SaleOrder(models.Model):

    _inherit = 'sale.order'


    avg_currency_rate = fields.Float(

        string="Currency Rate (Avg)",

        compute="_compute_avg_currency_rate",

        store=True,

        group_operator="avg",  # 👈 Key point — use average aggregation

    )


    @api.depends('currency_rate')

    def _compute_avg_currency_rate(self):

        for order in self:

            order.avg_currency_rate = order.currency_rate


Hope it helps.



Avatar
Discard
Related Posts Replies Views Activity
2
मार्च 17
3207
0
मार्च 15
4290
1
फ़र॰ 25
4262
1
नव॰ 24
1547
1
सित॰ 24
1577