Merge branch '11.0' of https://github.com/hootel/hootel into 11.0

This commit is contained in:
Jose Luis
2019-06-06 12:52:15 +02:00

View File

@@ -139,6 +139,18 @@ class ResPartner(models.Model):
'vat': vat_with_code 'vat': vat_with_code
}) })
@api.constrains('vat', 'commercial_partner_country_id')
def check_vat(self):
spain = self.env['res.country'].search([
('code', '=', 'ES')
])
from_spain = False
for partner in self:
if partner.country_id == spain:
from_spain = True
if from_spain:
return super(ResPartner, self).check_vat()
@api.constrains('vat') @api.constrains('vat')
def _check_vat_unique(self): def _check_vat_unique(self):
for record in self: for record in self: