İçereği Atla
Menü
Bu soru işaretlendi
1 Cevapla
4233 Görünümler

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
Vazgeç

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

Üretici

@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

Üretici

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

Üretici

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.

En İyi Yanıt

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
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
3
Mar 15
6521
1
Mar 15
9106
3
Nis 24
1818
3
Haz 24
5342
0
Eki 23
1424