Skip to Content
Menu
This question has been flagged
1 Reply
4612 Views

My client has asked to be able to modify the currency on mrp.bom.line items. We added x_currency_id to mrp.bom.line and made it a computed field equal to the currency_id of the product_id. 

This correctly displays the currency of the product. The problem however is that the currency of the product is a computed field. So no matter what we do we can not modify the value of the currency of the product as it is always the company's official currency.

Is it necessary that the currency of the product must be the default for the company. I understand I have the power to change this if I want. However if this would open more complications (accounting,inventory...) then I would obviously leave the definition of the currency of the product and simply break the association for mrp.bom.line whereas I would no longer make it a computed field, I would simply set a default based on the product and if someone changed it then so be it.

If anyone could lend me their input it would be greatly appreciated. I have my reservations about modifying a field which is such a core component however if it will not break anything and it will make my client happy then I don't mind. 

Please share your thoughts, and reword your criticisms as playful banter. 


Thanks!


Avatar
Discard
Best Answer

Currency is not an attribute of a product, it is an attribute of contractual relationships (pricelists) and of asset (inventory) valuation.

You can define multiple sales and purchasing prices in different currencies using Odoo's pricelists and multi-currency features.

Showing currencies in a BoM does not make sense, in a BoM you show the cost, and cost is always measured in the company's currency for accounting reasons.

Avatar
Discard
Author

Thanks for your input Ermin. I agree with your assessment.

Author

Currency however is still an attribute of a product in Odoo's model for product.template which you can see in the definition of the model but I know you were speaking generally of the definition of a product and not an Odoo product.template product.

You are right. Despite that, the currency in the product.template relates to the "standard" price and is not editable.

Do you know what is the consequences of changing the main company to be different company (In order to get a different currency on the product template)?

With this approch I was able to change the product.template currency_id

Code reference:

@api.depends('company_id')

def _compute_currency_id(self):

main_company = self.env['res.company']._get_main_company()

for template in self:

template.currency_id = template.company_id.sudo(

).currency_id.id or main_company.currency_id.id

Related Posts Replies Views Activity
1
Mar 18
6771
3
Mar 24
4949
0
Mar 24
206
2
Jan 24
15950
2
Dec 18
2454