Skip to content
Snippets Groups Projects
Commit accb722d authored by Maruan Aguerdouh (magm)'s avatar Maruan Aguerdouh (magm)
Browse files

[FIX] account_edi_ubl_cii: send and print working properly for invoices


with canary islands taxes

Steps to reproduce:

1. Go to Apps, and Install the module `l10n_es`
2. Go to Accounting App > Customer invoices
3. Create a new Invoice with fake comany, fake address with state set as
`Santa Cruz de Tenerife (ES)` and the ZIP set as 38400.
4. Add any line to the invoice and confirm.
5. Try to Send & Print the invoice, you may need to select the template
before.

Issue:

We won't be able to either print or send the Invoice getting a traceback
containing `KeyError: 'tax_details_per_record'`.

Solution:

Keys for `vals` have change so we need to adapt it to match new keys
naming and sorting for accesing the same values.

FW - port: master

opw-3067491

closes odoo/odoo#107095

Signed-off-by: default avatarGrazioso Andrea (agr) <agr@odoo.com>
parent e176ba0b
Branches
Tags
No related merge requests found
......@@ -88,8 +88,8 @@ class AccountEdiXmlCII(models.AbstractModel):
"shall be categorized with an Invoiced item VAT category code (BT-151).")
def _check_non_0_rate_tax(self, vals):
for line_vals in vals['tax_details_per_record']:
tax_rate_list = line_vals['line'].tax_ids.flatten_taxes_hierarchy().mapped("amount")
for line_vals in vals['tax_details']['tax_details_per_record']:
tax_rate_list = line_vals.tax_ids.flatten_taxes_hierarchy().mapped("amount")
if not any([rate > 0 for rate in tax_rate_list]):
return _("When the Canary Island General Indirect Tax (IGIC) applies, the tax rate on "
"each invoice line should be greater than 0.")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment