Skip to Content
Menu
This question has been flagged
2 Replies
1110 Views
I need to do that in the account_move view which is accounting - clients, I get the print or action tool which is a nut where you can delete, duplicate, or file I need to modify that nut and remove the delete, how can I do it by code or by study? I know that in v12 it could be hidden in the user but in v16 that does not appear


Avatar
Discard
Best Answer

Hi,

You can try this code

<record id="view_form_id" model="ir.ui.view">

  <field name="name">view name</field>

  <field name="model">my.model</field>

  <field name="priority" eval="10"/>

  <field name="arch" type="xml">

     <form string="..." duplicate="0">

     ...

     </form>

  </field>

</record>


or by extending an existing view:

<field name="arch" type="xml">

    <xpath expr="//form" position="attributes">

        <attribute name="duplicate">0</attribute>

    </xpath>

</field>

for Delete option:

1. In the tree/form view of the contact add the delete attribute. 

like <tree delete="0"> . for the form <form delete="0">

2. remove the user access rights of users for delete the contact from the menu "Access Rights"

3. override fields_view_get, you can also remove the option for the "delete" from the "Action Drop Down"

4. override the unlink. using this you have the option "delete" in the "Action" dropdown. but using the override unlink method you can raise an error, so the user cannot delete the contact.


Hope it helps

Avatar
Discard
Author Best Answer

me funciono perfecto muchas gracias

Avatar
Discard