Hello,
I have created a field for phone#no. What should be the type of that field so that it cannot accept character.
phone = fields.Char('Phone')Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hello,
I have created a field for phone#no. What should be the type of that field so that it cannot accept character.
phone = fields.Char('Phone')Odoo uses char() type
as we use python u can convert and do whatever u want to do
there's no other special field for that
and if we use int we can't add + / -
def validate_mobile(value):
""" Raise a ValidationError if the value looks like a mobile telephone number.
"""
rule = re.compile(r'/^[0-9]{10,14}$/')
if not rule.search(value):
msg = u"Invalid mobile number."
raise ValidationError(msg)
validation for mobile number
If it possible pls try this https://github.com/daviddrysdale/python-phonenumbers
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up
1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.
https://www.odoo.com/forum/help-1/question/need-to-validate-mobile-number-field-122454