diff --git a/l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py b/l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py index ba4959e45879..2aa51ec7c6d2 100644 --- a/l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py +++ b/l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py @@ -483,22 +483,24 @@ def adjust_accounting_data(self, product, line_vals): new_tax = product.product_tmpl_id.supplier_taxes_id[0] elif len(account.tax_ids) == 1: new_tax = account.tax_ids[0] - if new_tax: - line_tax_id = line_vals.get("tax_ids") and line_vals["tax_ids"][0][2][0] - line_tax = self.env["account.tax"].browse(line_tax_id) - if new_tax.id != line_tax_id: - if line_tax and new_tax._get_tax_amount() != line_tax._get_tax_amount(): - self.log_inconsistency( - _( - "XML contains tax %s. Product %s has tax %s. Using " - "the XML one" - ) - % (line_tax.name, product.name, new_tax.name) + line_tax_id = ( + line_vals.get("invoice_line_tax_ids") + and line_vals["invoice_line_tax_ids"][0][2][0] + ) + line_tax = self.env["account.tax"].browse(line_tax_id) + if new_tax and line_tax and new_tax != line_tax: + if new_tax._get_tax_amount() != line_tax._get_tax_amount(): + self.log_inconsistency( + _( + "XML contains tax %s. Product %s has tax %s. Using " + "the XML one" ) - else: - # If product has the same amount of the one in XML, - # I use it. Typical case: 22% det 50% - line_vals["tax_ids"] = [(6, 0, [new_tax.id])] + % (line_tax.name, product.name, new_tax.name) + ) + else: + # If product has the same amount of the one in XML, + # I use it. Typical case: 22% det 50% + line_vals["invoice_line_tax_ids"] = [(6, 0, [new_tax.id])] # move_line.tax_ids # move_line.name