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
- 会計
- 在庫
- PoS
- プロジェクト
- MRP
この質問にフラグが付けられました
2
返信
13149
ビュー
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
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.