How to validate email entered in odoo10?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
2
Replies
12481
Views
Hi , you can use below code to validate email Id:-
import re
from odoo.exceptions import ValidationError
@api.onchange('email_id')
def validate_mail(self):
if self.email_id:
match = re.match('^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$', self.email_id)
if match == None:
raise ValidationError('Not a valid E-mail ID')
Working thanks
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up
Wrong question asked, this question is not related to odoo, this is python related question. you may find the answer for this question on stack overflow. there are many examples available for this question on stack overflow. Please ask only odoo related question here, otherwise your question would be downgraded.