[FIX] Simple VAT check after VIES check fails

This commit is contained in:
Eduardo De Miguel
2022-05-24 18:17:54 +02:00
parent 795b3d6b4a
commit d24e005f2f

View File

@@ -1,6 +1,7 @@
# Copyright 2015 Tecnativa - Antonio Espinosa
# Copyright 2017 Tecnativa - David Vidal
# Copyright 2019 FactorLibre - Rodrigo Bonilla
# Copyright 2022 Moduon - Eduardo de Miguel
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models
@@ -29,6 +30,8 @@ class ResPartner(models.Model):
# call simple_vat_check and thus the flag will be removed
partner.update({"vies_passed": True})
res = super(ResPartner, self).vies_vat_check(country_code, vat_number)
if not res:
return self.simple_vat_check(country_code, vat_number)
return res
@api.constrains("vat", "country_id")