From 6481eca0200eddafc781ef4851ef1d910dde6700 Mon Sep 17 00:00:00 2001 From: "Nicolas (vin)" Date: Tue, 18 Jan 2022 14:03:26 +0000 Subject: [PATCH] [FIX] factur-x: fix line chargeAmount export The current behavior is that we are exporting the line subtotal as chargeAmount of the line. This is an issue as this field is expecting the unit price instead. A bugfix was done for importing extern invoices properly that broke importing factur-x files from Odoo as it doesn't support that custom behavior anymore. Thus, this will correct the export to properly store the unit price in the GrossPriceProductTradePrice ChargeAmount. At the same time, add the NetPriceProductTradePrice ChargeAmount, which is required and should contain the unit price with discount applied. closes odoo/odoo#83647 X-original-commit: c93f7dba0720e5e4f7d0a26ce05a854094e6a279 Signed-off-by: Laurent Smet Signed-off-by: Florian Gilbert Signed-off-by: Nicolas Viseur --- .../data/facturx_templates.xml | 16 +++++++++++++++- addons/account_edi_facturx/tests/test_facturx.py | 9 ++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/addons/account_edi_facturx/data/facturx_templates.xml b/addons/account_edi_facturx/data/facturx_templates.xml index 175092bacae..1f4eab0fc3d 100644 --- a/addons/account_edi_facturx/data/facturx_templates.xml +++ b/addons/account_edi_facturx/data/facturx_templates.xml @@ -26,10 +26,11 @@ + + t-esc="format_monetary(line.price_unit, record.currency_id)"/> @@ -39,6 +40,19 @@ + + + + + + + + + diff --git a/addons/account_edi_facturx/tests/test_facturx.py b/addons/account_edi_facturx/tests/test_facturx.py index f8185c7b74c..755a1eb4a17 100644 --- a/addons/account_edi_facturx/tests/test_facturx.py +++ b/addons/account_edi_facturx/tests/test_facturx.py @@ -82,7 +82,7 @@ class TestAccountEdiFacturx(AccountEdiTestCommon): - 1100.000 + 275.000 true @@ -90,6 +90,9 @@ class TestAccountEdiFacturx(AccountEdiTestCommon): 20.0 + + 220.000 + 5.0 @@ -171,8 +174,8 @@ class TestAccountEdiFacturx(AccountEdiTestCommon): }) applied_xpath = ''' - - 1000.000 + + 200.000