In a form view, what way would you have a field only be editable when the object is crated and not editable afterwards.
Câu hỏi này đã bị gắn cờ
2
Trả lời
19344
Lượt xem
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.
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng ký| Bài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
|---|---|---|---|---|
|
|
0
thg 12 19
|
8478 | ||
|
Field editing after create a form
Đã xử lý
|
|
1
thg 8 23
|
3774 | |
|
|
0
thg 4 21
|
4835 | ||
|
|
1
thg 7 19
|
8918 | ||
|
|
6
thg 12 25
|
49900 |