콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
653 화면

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:

  1. I want to use the invoice_currency_rate (or the corresponding field) to get the exchange rate for currency conversion.
  2. 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:

  1. The correct way to access the exchange rate in automations.
  2. 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!


아바타
취소
작성자 베스트 답변

I found the answer. My formula was wrong, but the way I called the field was right.
record.price_subtotal / record.move_id.invoice_currency_rate

Thank you

아바타
취소
관련 게시물 답글 화면 활동
1
2월 25
1476
1
5월 24
1428
0
11월 23
3438
0
8월 25
160
1
8월 25
285