跳至内容
菜单
此问题已终结
4032 查看

Hi, I have a scenario where I need to validate a email address whether it is valid or not. For validating I have used the following code.

hr_view.xml:

<field name="work_email" widget="email" on_change="onchange_work_email(work_email)"/>

hr.py

def onchange_work_email(self, cr, uid, ids, work_email):
    if re.match("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$", work_email) != None:
        return True
    else:
        raise osv.except_osv(_('Invalid Email'), _('Please enter a valid email address'))

But I got No handler found error. I made changes in only above two files, Did i need to import regular expressions ? what is the error ? Any appreciate suggestions

形象
丢弃

Look in you openerp-server.log. (the error is probably described in it)

相关帖文 回复 查看 活动
0
3月 15
3894
2
6月 23
2529
0
8月 16
5383
0
3月 15
3952
1
3月 15
6511