In a form view, what way would you have a field only be editable when the object is crated and not editable afterwards.
Tämä kysymys on merkitty
2
Vastaukset
19345
Näkymät
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.
Nautitko keskustelusta? Älä vain lue, vaan osallistu!
Luo tili jo tänään nauttiaksesi yksinoikeusominaisuuksista ja osallistuaksesi mahtavaan yhteisöömme!
Rekisteröidy| Aiheeseen liittyviä artikkeleita | Vastaukset | Näkymät | Toimenpide | |
|---|---|---|---|---|
|
|
0
jouluk. 19
|
8478 | ||
|
Field editing after create a form
Ratkaistu
|
|
1
elok. 23
|
3774 | |
|
|
0
huhtik. 21
|
4837 | ||
|
|
1
heinäk. 19
|
8919 | ||
|
|
6
jouluk. 25
|
49900 |