Skip to content
Snippets Groups Projects
Commit b2257dd0 authored by Ricardo Gomes Rodrigues (rigr)'s avatar Ricardo Gomes Rodrigues (rigr)
Browse files

[FIX] base_vat: only use VIES service for company VAT numbers


Some countries, such as Portugal, persons also have VAT-like tax
numbers, that can be used in invoices, just like company VAT numbers
can.

However, the VIES service does not work for these person VAT numbers,
only for companies.

This fix ensures that VIES validation is only used for companies.

closes odoo/odoo#80203

X-original-commit: f251358ae71ad481d044da36758a157ad2ec9abb
Signed-off-by: default avatarWilliam André (wan) <wan@odoo.com>
Co-authored-by: default avatarDaniel Reis <dreis.pt@hotmail.com>
Co-authored-by: default avatarRicardo Gomes Rodrigues (rigr) <rigr@odoo.com>
parent d251e5b1
No related branches found
No related tags found
No related merge requests found
......@@ -153,8 +153,8 @@ class ResPartner(models.Model):
for partner in self:
if not partner.vat:
continue
if company.vat_check_vies and partner.commercial_partner_id.country_id in eu_countries:
is_eu_country = partner.commercial_partner_id.country_id in eu_countries
if company.vat_check_vies and is_eu_country and partner.is_company:
# force full VIES online check
check_func = self.vies_vat_check
else:
......
......@@ -46,11 +46,6 @@ class TestStructure(SavepointCase):
"vat": "ATU12345675",
"company_type": "company",
})
contact = self.env["res.partner"].create({
"name": "Sylvestre",
"parent_id": company.id,
"company_type": "person",
})
# reactivate it and correct the vat number
with patch('odoo.addons.base_vat.models.res_partner.check_vies', type(self)._vies_check_func):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment