Community mailing list archives

Re: Make the whole record readonly in a specific state

Martin Trigaux (mat)
- 05/30/2016 05:11:22
On 30/05/16 11:07, Yassine Teimi wrote:
> I want to make all fields readonly when my model comes to a specific state.

on the field definition you can put something like

states={'done': [('readonly', True)]}

> I tried to make a group on the whole form, and add an attrs, but it
> damaged the view.

Then it's probably the view definition that is incorrect, it should work 
with an attrs.

> When I overrided *fields_view_get()*, it doesn't consider any
> attrs-readonly defined on the xml, so it's like it imposes to define all
> readonly fields on the*fields_view_get()*.

I would definitely discourage to override fields_view_get, that's 
probably overkill for what you are trying to achieve

Martin Trigaux