Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
3983 Zobrazení

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.

Avatar
Zrušit
Nejlepší odpověď

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)"/>
Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
srp 25
3535
1
říj 24
2126
2
čvc 24
2110
1
zář 23
2149
0
kvě 23
2304