From aa114f256bba8025448b3847404cc0d4551b956b Mon Sep 17 00:00:00 2001 From: "Anh Thao Pham (pta)" Date: Fri, 20 Oct 2023 09:19:03 +0000 Subject: [PATCH] [FIX] l10n_eg_edi_eta: fix EDI for fixed taxes Steps to reproduce: (ETA API credentials required) - Install l10n_eg_edi_eta - Switch to an Egyptian company - Configure ETA API Integration - Create a tax with "Fixed" as "Tax Computation" - Create an invoice with the created fixed tax - Send the invoice to ETA The invoice is rejected by ETA. Cause: The generated EDI document contains an entry looking like this: "taxableItems": [{"taxType": "T1", "amount": 28.0, "subType": "V009", "rate": 14.0}] where each element of "taxableItems" is a dict with the details of each applied tax. However, for fixed taxes, the "rate" key should not be there. Solution: Only populate the "rate" key if the tax is not a fixed one. opw-3436422 closes odoo/odoo#140850 X-original-commit: 07f6321f7fd64a394e348e37353f8300103a4a42 Signed-off-by: Anh Thao Pham (pta) Signed-off-by: Nicolas Viseur (vin) --- addons/l10n_eg_edi_eta/models/account_edi_format.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/l10n_eg_edi_eta/models/account_edi_format.py b/addons/l10n_eg_edi_eta/models/account_edi_format.py index 34f34e469b1..0b95a0a92f9 100644 --- a/addons/l10n_eg_edi_eta/models/account_edi_format.py +++ b/addons/l10n_eg_edi_eta/models/account_edi_format.py @@ -275,7 +275,7 @@ class AccountEdiFormat(models.Model): 'taxType': tax['tax_repartition_line'].tax_id.l10n_eg_eta_code.split('_')[0].upper().upper(), 'amount': self._l10n_eg_edi_round(abs(tax['tax_amount'])), 'subType': tax['tax_repartition_line'].tax_id.l10n_eg_eta_code.split('_')[1].upper(), - 'rate': abs(tax['tax_repartition_line'].tax_id.amount), + **({'rate': abs(tax['tax_repartition_line'].tax_id.amount)} if tax['tax_repartition_line'].tax_id.amount_type != 'fixed' else {}), } for tax_details in line_tax_details.get('tax_details', {}).values() for tax in tax_details.get('group_tax_details') ],