Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

'hr_employee' object has no attribute 'onchange_work_phone'

By
Urpit Timbadiya
on 9/27/13, 7:01 AM 936 views

I added a function to check work_phone field or 10 charecters but I get the error again and again.

my function in hr_employee class :

def onchange_work_phone(self, cr, uid, ids, work_phone, context=None):
    res = {'value':{}}
    if not work_phone:
        return res
    if len(work_phone) != 10:
        res['value']['work_phone'] = ''
        res['warning'] = {'title':'Error', 'messagge':'Insert 10 chars!'}
    return res

xml field line :

<field name="work_phone" on_change="onchange_work_phone(work_phone,context)"/>

Help me find my mistake here as I am new to openerp.

1

try to use this

  <field name="work_phone" on_change="onchange_work_phone(work_phone)"/>

rather than this:

 <field name="work_phone" on_change="onchange_work_phone(work_phone,context)"/>

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 9/27/13, 7:01 AM
Seen: 936 times
Last updated: 3/16/15, 8:10 AM