OpenERP Email validation

前端 未结 4 1959
萌比男神i
萌比男神i 2021-01-25 13:26

Please let me know , how to prevent record getting saved when user enters invalid email address. Right now system displays warning message for invalid email address which is a

4条回答
  •  迷失自我
    2021-01-25 13:52

    Propably you can override the create and write method to raise a ValidateError error for wrong input. References here: https://doc.openerp.com/trunk/server/api_models/

    class latest_base(osv.osv):
    
       def create(self, cr, uid, values, context=None):
            if not self.ValidateEmail(cr,uid,[],values['email']):
                raise ValidateError()
    

提交回复
热议问题