I tried to use attrs in <page> and <group>
as follows:
NOT WORKING
<group attrs="{'readonly':[('state','=','done')]}">
<field name="field1" />
<field name="field2" />
<field name="field3" />
<field name="field4" />
</group>
but readonly does not work in page and group. instead when tried with invisible, it worked.
So, should I use readonly for field level only or is there any better method?
WORKING
<group>
<field name="field1" attrs="{'readonly':[('state','=','done')]}" />
<field name="field2" attrs="{'readonly':[('state','=','done')]}"/>
<field name="field3" attrs="{'readonly':[('state','=','done')]}"/>
<field name="field4" attrs="{'readonly':[('state','=','done')]}"/>
</group>
Have you opened an issue in the odoo tracker ? Because it would be something really practical to have...
Hello Atchuthan, I have the same problem with you. Did you solve it?
@yopi, no. I set those 4 fields as read-only and not in group.
This would be very handy indeed.
Also documentation makes no mention that "Invisible" attribute is working, but not "readonly" and "required".
https://www.odoo.com/documentation/9.0/reference/views.html#structural-components