[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) <pta@odoo.com>
Signed-off-by: Nicolas Viseur (vin) <vin@odoo.com>
This commit is contained in:
Anh Thao Pham (pta)
2023-11-03 07:35:01 +00:00
parent 3ba512cfce
commit aa114f256b
@@ -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')
],