Odoo Help


How to make a field read-only on a on_change() event ? [Closed]

on 5/3/13, 8:22 AM 3,131 views

The Question has been closed

Sudhir Arya (ERP Harbor Consulting Services)
on 11/09/2013 02:34:55

I am working on a case where a field needs to be made readonly on on_change() event in openERP 7.0.


Sudhir Arya (ERP Harbor Consulting Services)

--Sudhir Arya (ERP Harbor Consulting Services)--
| 6 8 8
Ahmedabad, India
--Sudhir Arya (ERP Harbor Consulting Services)--

• Co-Founder & Co-Owner at ERP Harbor Consulting Services

• ERP Consultant / ERP Customization / TechnoFunctional Expert

• Sound knowledge in Python, Odoo (Open ERP), XML, PostgreSQL

• Domain knowledge of Sale Management, Purchase Management, Warehouse Management, Manufacturing, Multi Company Configuration & Management, HR Management, Medical Management, Construction Management, Education Management, Point of Sale, Third Party Integrations

• Positive attitude and quick Learner

• Good analytical skill, quick bug and issue tracing and find the solution

• Good knowledge and experience in payment gateway integration with Odoo

• Ready to accept new challenges

• Active Memeber On Stackoverflow 




Sudhir Arya
ERP Harbor Consulting Services
Sudhir Arya (ERP Harbor Consulting Services)
On 5/3/13, 8:39 AM

It is not possible with onchange because from onchange you can only return value, domain and warning.

You can achieve your requirement on other way by using attrs.


<field name="your_field" attrs="{'readonly': [('field_name', 'operator', 'value')]}"/>

For example I want to make my field readonly when other field's value is service:

<field name="your_field" attrs="{'readonly': [('field_name', '=', 'service')]}"/>

Hi sudhir, how to configure a customer portal,who can see the product list and make sale order only.

on 5/3/13, 9:04 AM

Hello Sudhir Arya it worked great .. Thank you very much..

on 5/3/13, 9:10 AM

Hai Sudhir, Did you get my question?

on 5/3/13, 9:27 AM

it is not working for mr still have the same problem the value not saving ?!

Ahmed elbarbary
on 4/8/15, 8:54 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

0 follower(s)


Asked: 5/3/13, 8:22 AM
Seen: 3131 times
Last updated: 3/16/15, 8:10 AM