Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odgovori
4242 Prikazi

I'm new to Odoo and I am still creating and customizing my database. So please bear with me :)


we are using 2 currencies in our company (USD) & (EGP) I want to use the current exchange rate for the USD to calculate some revenue in one of the functions inside the Employees Module, to show some revenue related to some of the employees.


I activated the automatic currency rate feature and it's working fine, I just want to know how can I convert a given USD amount in a text field to display in another (read only) as in the EGP. How can I call for the exchange rate to use it in the equation?


I know some Python and I use it to do small calculations in these fields, but I have no idea how to use the current currency rate in the function. Any help? 

Avatar
Opusti

Could you share a screenshot that indicates where you want to display the amounts in both currencies?

Avtor

@Yanelis I can't seem to find a way to share with you the screenshot here on the forums! Pardon my ignorance...

Don't worry, I can help. Follow this steps
- Take a screenshot
- Edit the picture and copy with (ctrl+c)
- Edit your question in the forum and copy the picture (ctrl+v)
- Save

Avtor

It said I need 20 Karma to be able to post a photo or link

Avtor

I will try to explain further. It's inside the employee module in the employee data, below there is a multi-tab window. I added a new tab that calculate some Expenses and Revenue related to that employee. The Expenses are all in EGP but the revenue are all in USD. So in order to calculate the final Net Revenue, I have to convert the USD to EGP with the updated rate. In the currency settings I already set the USD rate to update automatically on a weekly basis & this part working fine. My question is there a way to call for that rate to do my calculation automatically.

Best Answer

Hi 

To convert an amount from one currency to another in Odoo, you can utilize the default function `_convert` available in the `res.currency` model. This function provides a convenient way to perform currency conversion calculations.

Code sample:self.company_id.currency_id._convert(imbalance_amount, self.currency_id, self.company_id, fields.Date.context_today(self))
Definition:from_currency._convert(from_amount, to_currency, company, date)

Hope it helps

Avatar
Opusti
Related Posts Odgovori Prikazi Aktivnost
3
mar. 15
6525
1
mar. 15
9107
3
apr. 24
1821
3
jun. 24
5344
0
okt. 23
1424