Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
3 Odpovědi
18205 Zobrazení

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.

Avatar
Zrušit

you can restrict the edit button by extending the formview js

Nejlepší odpověď

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>

 

Avatar
Zrušit

Can you elaborate more on this?

Nejlepší odpověď

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.

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
2
bře 19
3077
2
říj 18
5242
2
bře 23
9974
2
bře 23
2413
2
čvc 22
8980