diff --git a/l10n_it_fatturapa_in/models/partner.py b/l10n_it_fatturapa_in/models/partner.py index 058ce43dc584..f9cd48f0d2e8 100644 --- a/l10n_it_fatturapa_in/models/partner.py +++ b/l10n_it_fatturapa_in/models/partner.py @@ -49,3 +49,10 @@ class Partner(models.Model): "-1 to use the default precision", default=-1, ) + + # https://github.com/odoo/odoo/pull/71920 + # this is temporary fix, we depend on the issue do the solved for our test + # to be all green + def _split_vat(self, vat): + vat = vat.replace(" ", "") + return super()._split_vat(vat) diff --git a/l10n_it_fatturapa_in/tests/test_import_fatturapa_xml.py b/l10n_it_fatturapa_in/tests/test_import_fatturapa_xml.py index 8592532844c8..aaa207ee9b05 100644 --- a/l10n_it_fatturapa_in/tests/test_import_fatturapa_xml.py +++ b/l10n_it_fatturapa_in/tests/test_import_fatturapa_xml.py @@ -663,10 +663,22 @@ def test_44_xml_import(self): def test_45_xml_import_no_duplicate_partner(self): partner_id = self.env["res.partner"].search([("vat", "ilike", "05979361218")]) - partner_id.vat = " %s " % partner_id.vat - res = self.run_wizard("test45", "IT05979361218_001.xml") + if not partner_id: + # load bill (when this test is run by itself) + res = self.run_wizard("test45a", "IT05979361218_001.xml") + partner_id = self.env["res.partner"].search( + [("vat", "ilike", "05979361218")] + ) + + # try and alter the vat of the existing partner + partner_id.write({"vat": " %s " % partner_id.vat}) + + # load bill (2nd time) + res = self.run_wizard("test45b", "IT05979361218_001.xml") invoice_id = res.get("domain")[0][2][0] invoice = self.invoice_model.browse(invoice_id) + + # check for duplicates self.assertEqual(invoice.partner_id.id, partner_id.id) self.assertEqual( len(self.env["res.partner"].search([("vat", "ilike", "05979361218")])), 1