odoo/odoo#249561

Created by fw-bot
Merged at f0880d0db3426a9a8c556efba3e6407ee3375ca2

Statuses:

label
odoo-dev:saas-18.3-18.0-opw-5927356-fix-agr-500246-fw
head
e0b9429119d1d95116d65d759e594706c8a0e78d
merged
4 months ago by Accounting, Laurent Smet (las)
odoo/odoo
18.0 #248882
saas-18.2 #249524
saas-18.3 #249561
saas-18.4 #249598
19.0 #249674
saas-19.1 #250191
saas-19.2 #250221
saas-19.3
master #250249

[FIX] l10n_es_edi_facturae: use currency dependent rounding for amounts

Steps to reproduce:
- Have facturae modules installed
- Generate invoice with any amount
- Send to Facturae

Issue:
Resulting XML has 8 digits after the decimal point on several fields, such as unit price, gross amount, and total cost.

When trying to validate such an XML, this results in validation error: "RCF06001: En facturas emitidas en euros, alguno de los importes de las líneas tiene más de dos decimales (regla 6a del anexo II de la Orden HAP/1650/2015)."

According to regulation HAP/1650/2015 [1]: For invoices issued in euros, it will be validated that the total line amounts related to the total cost are numeric and rounded, according to the common rounding method, to two decimal places.
This commit introduces dynamic decimal precision: 2 places for EUR and 8 places (the previous default) for other currencies.

[1] https://www.boe.es/diario_boe/txt.php?id=BOE-A-2015-8844
Machine translated BOE-A-2015-8844 (1).pdf

opw-5927356

Forward-Port-Of: #248882