[FIX] l10n_ar: currency rate on post method

The currency rate could be different if the invoice date is different that the accounting date

Steps to reproduce:
1- Install l10n_ar
2- Create two different currency rate for foreign currency (i.e: Dollar) with also different Date
3- Create an invoice setting the currency as foreign currency (i.e: Dollar)

Current behavior before PR:
In page "Journal Items" could see that each account line use the currency rate defined by the accounting date,
however the currency rate filed (which is not visible) is defined by the invoice date.

Desired behavior after PR is merged:
Use always the accounting date to set the currency rate

+ CLA signing Augusto Weiss

closes odoo/odoo#83689

X-original-commit: 21692f28fd1db7097e1d4c23ce7dcbaa76936449
Signed-off-by: Josse Colpaert <jco@odoo.com>
This commit is contained in:
Augusto Weiss
2022-01-31 15:33:41 +00:00
committed by Josse Colpaert
parent ade02c9b73
commit 75c62022da
2 changed files with 2 additions and 1 deletions
+1 -1
View File
@@ -164,7 +164,7 @@ class AccountMove(models.Model):
rec.l10n_ar_currency_rate = 1.0
elif not rec.l10n_ar_currency_rate:
rec.l10n_ar_currency_rate = rec.currency_id._convert(
1.0, rec.company_id.currency_id, rec.company_id, rec.invoice_date or fields.Date.today(), round=False)
1.0, rec.company_id.currency_id, rec.company_id, rec.date, round=False)
# We make validations here and not with a constraint because we want validation before sending electronic
# data on l10n_ar_edi
+1
View File
@@ -19,3 +19,4 @@ Bruno Zanotti bz@adhoc.com.ar https://github.com/Bruno-Zanotti
Pablo Santiago Paez Sheridan pp@adhoc.com.ar https://github.com/PabloPaezSheridan
Juan Ignacio Carreras jc@adhoc.com.ar https://github.com/jcadhoc
Joel Zilli joz@adhoc.com.ar https://github.com/JoelZilli
Augusto Weiss awe@adhoc.com.ar https://github.com/augusto-weiss