In a form view, what way would you have a field only be editable when the object is crated and not editable afterwards.
Denna fråga har flaggats
2
Svar
19353
Vyer
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)]}"/>
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
nice post.
Njuter du av diskussionen? Läs inte bara, delta också!
Skapa ett konto idag för att ta del av exklusiva funktioner och engagera dig i vår fantastiska community!
Registrera dig| Relaterade inlägg | Svar | Vyer | Verksamhet | |
|---|---|---|---|---|
|
|
0
dec. 19
|
8480 | ||
|
|
1
aug. 23
|
3776 | ||
|
|
0
apr. 21
|
4842 | ||
|
|
1
juli 19
|
8925 | ||
|
|
6
dec. 25
|
49910 |