Hi all,
I need to validate mobile field in res.partner object.
1.If i have not enter any value in mobile field, it should allow to save the record.
2.If i enter more than 10 digits or less than 10 digits means, it should show Warning while saving.
3.If i enter characters, it should show warning that cannot enter numerics.
Please share code if anyone done this code before and which way we can implement this requirement.
Thanks in advance.
Validation 3:
Add this line too in to the above answer;
>>> if rec.phone_number and not str(rec.phone_number).isdigit():
raise ValidationError(_("Cannot enter numerics"))