Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
2 Antwoorden
17095 Weergaven

In a form view, what way would you have a field only be editable when the object is crated and not editable afterwards.
 

Avatar
Annuleer
Auteur Beste antwoord

An object on create will not have an id. Afterwards, it will always have one.

Taking advantage of this behaviour, the id can be used to set the readonly attribute.

<field name="id" invisible="1"/>

<field name="uneditable_field" attrs="{'readonly': [('id', '!=', False)]}"/>

Avatar
Annuleer

Well done. I was stuggled with this. I didn't think to add the "id" field as invisible to make it available in the domain. Thanks for sharing! J

Beste antwoord

nice post.


Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
0
dec. 19
6313
1
aug. 23
2048
0
apr. 21
3294
1
jul. 19
7024
6
jul. 24
45774