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.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Contabilità
- Magazzino
- PoS
- Project
- MRP
La domanda è stata contrassegnata
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...
Can you give an example for this, I used this code but I get attribute error. Please help me through.
Please, open another ask for another problem! This is solved, yet.
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
Ti stai godendo la conversazione? Non leggere soltanto, partecipa anche tu!
Crea un account oggi per scoprire funzionalità esclusive ed entrare a far parte della nostra fantastica community!
Registrati