Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
3 ตอบกลับ
18196 มุมมอง

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.

อวตาร
ละทิ้ง

you can restrict the edit button by extending the formview js

คำตอบที่ดีที่สุด

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>

 

อวตาร
ละทิ้ง

Can you elaborate more on this?

คำตอบที่ดีที่สุด

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.

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
Button to open form. V11 แก้ไขแล้ว
2
มี.ค. 19
3076
2
ต.ค. 18
5239
2
มี.ค. 23
9966
Cacher le bouton "créer" d'une liste แก้ไขแล้ว
2
มี.ค. 23
2407
2
ก.ค. 22
8978