In a form view, what way would you have a field only be editable when the object is crated and not editable afterwards.
Bu soru işaretlendi
2
Cevaplar
19328
Görünümler
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.
Tartışma hoşunuza mı gidiyor? Sadece okumakla kalmayın, katılın!
Özel özelliklerden yararlanmak ve harika topluluğumuzla etkileşime geçmek için bugün bir hesap oluşturun!
Üye Ol| İlgili Gönderiler | Cevaplar | Görünümler | Aktivite | |
|---|---|---|---|---|
|
|
0
Ara 19
|
8475 | ||
|
|
1
Ağu 23
|
3771 | ||
|
|
0
Nis 21
|
4830 | ||
|
|
1
Tem 19
|
8911 | ||
|
|
6
Ara 25
|
49874 |