How can I display order and lines total in company currency when making order with foreign currency?
Note: I'm using Odoo Enterprise
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project
- MRP
This question has been flagged
Hi,
In Odoo Enterprise, when creating orders in a foreign currency, totals are automatically computed in the company currency for accounting purposes, but they may not be visible on the order form by default. To display them, you can enable multi-currencies in Accounting → Configuration → Settings and ensure the company currency is set correctly. Some settings, like “Show Amount in Company Currency,” can make the company currency total visible on the order.
For more detailed visibility, including line-level totals, a small customization can be added. This involves creating computed fields on both the order lines and the order itself, converting the foreign currency amounts to the company currency using Odoo’s _convert method. This approach allows users to see both the foreign currency and company currency totals directly on the order form and lines.
Overall, Odoo Enterprise supports displaying totals in company currency either via built-in settings or minor customizations to provide more detailed visibility for orders in foreign currencies.
1-Add fields on the order line:from odoo import fields, models, api
class SaleOrderLine(models.Model):
_inherit = 'sale.order.line'
price_subtotal_company = fields.Monetary(
string='Subtotal (Company Currency)',
currency_field='order_id.company_currency_id',
compute='_compute_subtotal_company',
store=True,
)
@api.depends('price_subtotal', 'order_id.currency_id', 'order_id.company_currency_id')
def _compute_subtotal_company(self):
for line in self:
line.price_subtotal_company = line.order_id.currency_id._convert(
line.price_subtotal,
line.order_id.company_currency_id,
line.company_id,
line.order_id.date_order or fields.Date.today()
)
2-Add a field on the order:
class SaleOrder(models.Model):
_inherit = 'sale.order'
amount_total_company = fields.Monetary(
string='Total (Company Currency)',
currency_field='company_currency_id',
compute='_compute_amount_total_company',
store=True,
)
@api.depends('amount_total', 'currency_id', 'company_currency_id')
def _compute_amount_total_company(self):
for order in self:
order.amount_total_company = order.currency_id._convert(
order.amount_total,
order.company_currency_id,
order.company_id,
order.date_order or fields.Date.today()
)
Hope it helps
Where can I find this setting “Show Amount in Company Currency,”?
There is no such option. This answer appears to have been generated by AI and that part is fictional.
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up