Hi all,
i'm testing some validation functions for the phone field to avoid others characters than numbers from 0 to 9.
def valide_tel(self, cr, uid, ids, context=None):
record = self.browse(cr, uid, ids)
pattern = "^\+?[0-9]*$"
for data in record:
if re.match(pattern, data.phone) == None:
return False
return True
I tested the regex on pythex.org with success, but the problem is that when no phone number is entered, Odoo complains about ValidationError: expected string or buffer.
What can i do to have this working?
Thanks