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
- Contabilità
- Magazzino
- PoS
- Progetti
- MRP
La domanda è stata contrassegnata
2
Risposte
13152
Visualizzazioni
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
Ti stai godendo la conversazione? Non leggere soltanto, partecipa anche tu!
Crea un account oggi per scoprire funzionalità esclusive ed entrare a far parte della nostra fantastica community!
Registrati
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.