Odoo Help

Welcome!

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.

0

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

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

Hi,

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?

Cheers!

0

deep

--deep--
1617
| 5 4 7
Bengaluru, India
--deep--

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

deep
On 7/15/14, 4:42 AM

Hi..

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

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)

Stats

Asked: 7/12/14, 10:46 AM
Seen: 616 times
Last updated: 3/16/15, 8:10 AM