İçereği Atla
Menü
Bu soru işaretlendi
2 Cevaplar
17238 Görünümler

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

Avatar
Vazgeç
Üretici En İyi Yanı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)]}"/>

Avatar
Vazgeç

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

En İyi Yanıt

nice post.


Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
0
Ara 19
6463
1
Ağu 23
2173
0
Nis 21
3370
1
Tem 19
7172
6
Tem 24
46196