Se rendre au contenu
Menu
Cette question a été signalée
1 Répondre
4239 Vues

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
Ignorer

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

Auteur

@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

Auteur

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

Auteur

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.

Meilleure réponse

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
Ignorer
Publications associées Réponses Vues Activité
3
mars 15
6525
1
mars 15
9107
3
avr. 24
1821
3
juin 24
5344
0
oct. 23
1424