My onchange method works before writing some data in Mobile field.How can I fix this?Thank You.
class similar_contact(models.Model):
_inherit= 'res.partner'
@api.multi
@api.onchange("mobile")
def onchange_mobile(self):
mobile_id=self.search([('mobile','=',self.mobile)])
if mobile_id:
raise ValidationError(_('Similar Mobile Number exist'))
else:
raise ValidationError(_('No Similar Mobile'))