Hi, I need help with a condition inside the tag, this tree has the custom model "policy_line", however, I need to disable the Delete button (trash can) when the state of another custom model (policy) is 'done'.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
The way I achieved it is using attrs="{'readonly': [('state','in',['done','ok'])]}
In Odoo, disabling the delete button in a tag can be achieved by modifying the view (XML) file associated with the model. You can add an attribute "attrs" to the tag and set the "invisible" attribute on the delete button element.
attrs="{'invisible': [('id', '=', False)]}">
It's worth noting that this will make the delete button invisible if the record has no ID.
You can also use the "states" attribute instead of "attrs" and use it to control the visibility of the button based on the state of the record.
Copy code
I have the same concern, how to hide the trash button if the state is in a specific condition,
I have tried something like:
<xpath expr="//page[@name='recurring_invoice_line']//tree" position="attributes">
<attribute name="delete">0</attribute>
<attribute name="attrs">{'invisible': [('state', 'in', ['confirmed', 'done'])]}</attribute>
</xpath>
But it doesn't works.
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 | |
---|---|---|---|---|
Dynamic tree view in odoo 12
Đã xử lý
|
|
2
thg 9 23
|
4594 | |
tree control attribute
Đã xử lý
|
|
1
thg 7 19
|
10705 | |
|
0
thg 4 19
|
2273 | ||
Odoo Mail Sending Limit
Đã xử lý
|
|
2
thg 12 23
|
14737 | |
|
0
thg 10 23
|
33 |