Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
3 Trả lời
18197 Lượt xem

How to hide the edit and create buttons conditionally in a form view of a model?

For example i want to hide these buttons if the state for the model is 'Done', if it is not then they should appear.

Thanks in advance.

Ảnh đại diện
Huỷ bỏ

you can restrict the edit button by extending the formview js

Câu trả lời hay nhất

Hi Santos,

You can hide the edit and create buttons conditionally using record rule. You need to set a domain in record rule.

 

<record model="ir.rule" id="reference_id">

<field name="name">reference name</field>

<field name="model_id" ref="model_model_name"/>

<field eval="0" name="perm_unlink"/>

<field eval="0" name="perm_write"/>

<field eval="1" name="perm_read"/>

<field eval="0" name="perm_create"/>

<field name="domain_force">[ ('state','in',['open','paid'])]</field>

</record>

 

Ảnh đại diện
Huỷ bỏ

Can you elaborate more on this?

Câu trả lời hay nhất

this module will help.

https://github.com/faniska/odoo-addons/tree/10.0/hide_action_buttons

It is for Odoo 10, but code is simple to port for latest versions.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 3 19
3076
2
thg 10 18
5239
2
thg 3 23
9966
2
thg 3 23
2408
2
thg 7 22
8978