In a form view, what way would you have a field only be editable when the object is crated and not editable afterwards.
Această întrebare a fost marcată
2
Răspunsuri
19332
Vizualizări
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.
Îți place discuția? Nu doar citi, alătură-te!
Creează-ți un cont astăzi pentru a beneficia de funcții exclusive și a interacționa cu minunata noastră comunitate!
Înscrie-te| Postări similare | Răspunsuri | Vizualizări | Activitate | |
|---|---|---|---|---|
|
|
0
dec. 19
|
8477 | ||
|
Field editing after create a form
Rezolvat
|
|
1
aug. 23
|
3771 | |
|
|
0
apr. 21
|
4832 | ||
|
|
1
iul. 19
|
8915 | ||
|
|
6
dec. 25
|
49879 |