Dear Alll,
I've inherited model "hr.applicant". I'd like to validate mobile phone in filed "hr.applicant.partner_mobile".
But the constrains does not execute.
class MyRecruitment(models.Model):
_inherit = ['hr.applicant']
@api.one
@api.constrains('partner_mobile')
def _check_partner_mobile(self):
pattern = re.compile("^[0]{1}[0-9]{9}$")
if not bool(pattern.match(self.partner_mobile)):
raise ValidationError(_('Invalid mobile phone number!.'))