Odoo Help


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.


How to do client side validation in openerp ?

on 4/24/13, 12:07 PM 3,085 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--
| 5 7 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

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)


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