In a form view, what way would you have a field only be editable when the object is crated and not editable afterwards.
لقد تم الإبلاغ عن هذا السؤال
2
الردود
19339
أدوات العرض
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.
هل أعجبك النقاش؟ لا تكن مستمعاً فقط. شاركنا!
أنشئ حساباً اليوم لتستمتع بالخصائص الحصرية، وتفاعل مع مجتمعنا الرائع!
تسجيل| المنشورات ذات الصلة | الردود | أدوات العرض | النشاط | |
|---|---|---|---|---|
|
|
0
ديسمبر 19
|
8477 | ||
|
|
1
أغسطس 23
|
3771 | ||
|
|
0
أبريل 21
|
4834 | ||
|
|
1
يوليو 19
|
8918 | ||
|
|
6
ديسمبر 25
|
49891 |