Skip to content

Commit f45c7ae

Browse files
committed
WIP: fixing tests 2
1 parent 740bd6e commit f45c7ae

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

l10n_it_fatturapa_in/tests/test_import_fatturapa_xml.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -942,6 +942,7 @@ def vat_partner_exists():
942942
not_valid_vat=not_valid_vat,
943943
),
944944
)
945+
self.wizard_model.reset_inconsistencies()
945946

946947
def test_01_xml_link(self):
947948
"""
@@ -1022,6 +1023,7 @@ def test_01_xml_zero_quantity_line(self):
10221023

10231024
def test_xml_import_summary_tax_rate(self):
10241025
# Invoice with positive total. Detail Level: '1' -- Tax Rate
1026+
# Note: this test depends on test_14_xml_import for supplier creation
10251027
supplier = self.env["res.partner"].search([("vat", "=", "IT02780790107")])[0]
10261028
# in order to make the system create the invoice lines
10271029
supplier.e_invoice_detail_level = "1"

l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -549,8 +549,10 @@ def adjust_accounting_data(self, product, line_vals):
549549
new_tax = product.product_tmpl_id.supplier_taxes_id[0]
550550
elif len(account.tax_ids) == 1:
551551
new_tax = account.tax_ids[0]
552-
line_tax_id = line_vals.get("tax_ids") and line_vals["tax_ids"][0][2][0]
553-
line_tax = self.env["account.tax"].browse(line_tax_id)
552+
line_tax = self.env["account.tax"]
553+
if line_vals.get("tax_ids") and line_vals["tax_ids"][0] == fields.Command.SET:
554+
line_tax_id = line_vals["tax_ids"][0][2][0]
555+
line_tax = self.env["account.tax"].browse(line_tax_id)
554556
if new_tax and line_tax and new_tax != line_tax:
555557
if new_tax._get_tax_amount() != line_tax._get_tax_amount():
556558
self.log_inconsistency(
@@ -574,7 +576,9 @@ def _prepareInvoiceLineAliquota(self, credit_account_id, line, nline):
574576
retLine = {}
575577
account_taxes = self.get_account_taxes(line.AliquotaIVA, line.Natura)
576578
if account_taxes:
577-
retLine["tax_ids"] = [(6, 0, [account_taxes[0].id])]
579+
retLine["tax_ids"] = [fields.Command.set([account_taxes[0].id])]
580+
else:
581+
retLine["tax_ids"] = [fields.Command.clear()]
578582

579583
retLine.update(
580584
{

0 commit comments

Comments
 (0)