Odoo Help


How to do client side validation in openerp ?

on 4/24/13, 12:07 PM 4,338 views

I have a scenario where I need to check a field whether it has exactly 10 numbers not more than 10 neither less than 10.


Francesco OpenCode

--Francesco OpenCode--

| 6 8 9
Grottaglie, Italy
--Francesco OpenCode--

Italian Odoo (OpenERP) Modules Developer LINKEDIN: http://www.linkedin.com/in/francescoapruzzese

Francesco OpenCode
On 4/24/13, 12:16 PM

Use on_change. Create an on_change function that get the some field where is applicated. The function control the field value lenght and validate it.

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

Thank you Francesco Apruzzese it was very much usefull...

on 5/3/13, 8:18 AM

Can you give an example for this, I used this code but I get attribute error. Please help me through.

Urpit Timbadiya
on 9/27/13, 4:07 PM

Please, open another ask for another problem! This is solved, yet.

Francesco OpenCode
on 9/30/13, 1:29 PM

Hi, Thanks for your informations. But my requirement is i need to validate fields using java script in openerp 7. Ex : In purchase order line form view i have 2 fields po_qty and pi_qty. If user enter po_qty is greater than pi_qty system should alert using Java script instead of python.

Kindly help me how to achieve this..Thanks in advance

on 11/22/13, 1:34 AM

About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 4/24/13, 12:07 PM
Seen: 4338 times
Last updated: 3/16/15, 8:10 AM