Odoo Help


How to set the complete record / view to readonly based on the records state

Hochschule für Technik und Wirtschaft des Saarlandes
on 7/12/14, 10:46 AM 1,042 views


I have a model with more than 15 fields. In this model I have `state` field which indicates if the record might be able to be modified or readonly.

Is there a convienient way to set all fields to `readonly` based on the state in my model,

a) in the view or
b) in the model itself.

I dont want to override the models `write` method since the fields on the frontend suggest the user that he can change the values. I event do not want to add `attrs="{'readonly':[('state','not','draft')]}"` to all the fields in my view!

I tried to add the above `attrs=...` to the `group` tags in the view, but that does not seem to work (V8 RC1).

Any suggestions for a handy way to handle my requirement?



Techno-Functional Associate with 7+ years of experience in Odoo (formerly known as OpenERP).

On 7/15/14, 4:42 AM


You can set the state attribute in python columns... That is the fesible option to lock your record based on a state value..

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: 7/12/14, 10:46 AM
Seen: 1042 times
Last updated: 3/16/15, 8:10 AM