Skip to Content
Menu
This question has been flagged
2958 Views
when I create below code geeting error 
AttributeError: 'bool' object has no attribute 'get

class ResPartner(models.Model):

_inherit='res.partner'

@api.onchange('email')
def onchange_email(self):
if self.email:
if re.match(r"^[A-Za-z0-9\.\+_-]+@[A-Za-z0-9\._-]+\.[a-zA-Z]*$", self.email)!=None:
return True
else:
raise UserError(_('Please Enter a Valid Email Address! \n Thank You!'))
else:
return True

     if re.match("^(((\+?\(971\))|0|((00|\+)?971))-?)?[7-9]\d{9}$", self.mobile) != None:
    return True
else:
raise UserError(_('Please Enter a Valid Mobile Number! \n Thank You!'))
Avatar
Discard

My be this link can help you: https://www.odoo.com/forum/help-1/question/resloving-attributeerror-bool-object-has-no-attribute-lower-erreur-123491. just print and check the what is the value you get from " re.match(r"^[A-Za-z0-9\.\+_-]+@[A-Za-z0-9\._-]+\.[a-zA-Z]*$", self.email)".