In a form view, what way would you have a field only be editable when the object is crated and not editable afterwards.
Этот вопрос был отмечен
2
Ответы
19347
Представления
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
|
8478 | ||
|
|
1
авг. 23
|
3776 | ||
|
|
0
апр. 21
|
4838 | ||
|
|
1
июл. 19
|
8921 | ||
|
|
6
дек. 25
|
49905 |