跳至内容
菜单
此问题已终结
1 回复
4229 查看

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? 

形象
丢弃

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

编写者

@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

编写者

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

编写者

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.

最佳答案

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

形象
丢弃
相关帖文 回复 查看 活动
3
3月 15
6517
1
3月 15
9106
3
4月 24
1817
3
6月 24
5339
0
10月 23
1424