Files
odoo_source/addons/l10n_sa_edi
sesn-odoo b5f45c9aee [FIX] l10n_sa_edi: display correct currency rate
Currently, attempting to print an unconfirmed Saudi invoice in foreign
currency results in an error. Furthermore, even if the invoice is
confirmed,  the exchange rate displayed is not correct, the rate of the
confirmation date is used, instead of the accounting date.

Steps to reproduce
------------------
* install `l10n_sa_edi`
* switch to a Saudi company
* create an invoice in a foreign currency.
* without confirming the invoice, attempt to print it

You should be met with a traceback: `Undefined Function: operator does
not exist: date <= boolean`

* confirm the invoice, ensuring the confirmation and invoice dates have
  different currency rates.
* print the confirmed invoice.* print the invoice

You should see that the printed rate does not align with the actual
transaction amounts.

Cause
-----
The system incorrectly uses the `l10n_sa_confirmation_datetime` to
calculate and display the currency rate on the PDF. This field is only
populated upon invoice confirmation, leading to errors when printing
unconfirmed invoices. Moreover, using this date for confirmed invoices
results in displaying an incorrect rate, as it may differ from the
`invoice_date`, which should be used for accurate rate calculations.

opw-3731624

closes odoo/odoo#159698

X-original-commit: 67da9437d3606cb8a291c071214cc30914ce7fb0
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
Signed-off-by: Séna Serge Nshimiyimana (sesn) <sesn@odoo.com>
2024-03-29 07:53:02 +00:00
..
…
…
…