Hello Odoo Community,
I’m currently working on an automation in Odoo Online where I need to convert the invoice subtotal (EUR) to another currency (GNF) using the exchange rate. I found the technical name for the rate field, but I’m encountering an issue when trying to use it in my automation.
Here’s what I’m trying to do:
-
I want to use the invoice_currency_rate (or the corresponding field) to get the exchange rate for currency conversion.
-
I’m trying to access the field in an automated action and perform the conversion on the invoice subtotal.
However, every time I try to use the field invoice_currency_rate, I get the following error:
Traceback (most recent call last): File "/home/odoo/src/odoo/18.0/odoo/tools/safe_eval.py", line 397, in safe_eval return unsafe_eval(c, globals_dict, locals_dict) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 1, in <module> NameError: name 'invoice_currency_rate' is not defined
What I’ve Tried:
- I’ve confirmed that the technical name I’m using is correct.
- I double-checked that the field should be available on the same model (account.move.line), but it still throws the error.
- I’ve tried different ways to reference the invoice_currency_rate (e.g., record.invoice_currency_rate, record.currency_id.rate), but nothing seems to work.
My Understanding:
From my research, I believe the issue could be related to how the invoice_currency_rate is stored and accessed within Odoo. My guess is that it might not be directly available under the account.move.line model, but when I check, the field appears to be there.
Could anyone guide me on:
- The correct way to access the exchange rate in automations.
- Why I might be encountering this error and how to fix it.
I’d appreciate any help or suggestions! I've attached a screenshot showing the error if that helps.
Thanks in advance for your assistance!