1

By default Tree view in Odoo has Create, Import and Export All button showing on top. How do I hide them based on User groups? Also I should be able to hide Create button but without hiding Import button.

2 Answers2

3

You can hide the buttons like so:

<tree create="false" edit="false" delete="false" duplicate="false">

To do this per user group, create an inherited view and specify the group in the inherit view like so:

<record model="ir.ui.view" id="view_model_name_tree_inherit">
    <field name="name">model.name.tree.inherit</field>
    <field name="model">model.name</field>
    <field name="type">tree</field>
    <field name="inherit_id" ref="module_name.tree_name" />
    <field name="groups_id" eval="[(4, ref('module_name.group_name'))]"/>
    <field name="arch" type="xml">
        <tree position="attributes">
            <attribute name="create">false</attribute>
            <attribute name="edit">false</attribute>
            <attribute name="delete">false</attribute>
            <attribute name="duplicate">false</attribute>
        </tree>
    </field>
</record>

Unfortunately the Create and Import buttons are both linked to the create attribute.

To disable the "Export" button, you will need to install a module as this is not supported on Odoo default. See this module

adekock11
  • 544
  • 2
  • 11
  • 1
    FYI, since Odoo Version 13.0, there is a way to disable import and export via the tree view XML: https://www.odoo.com/documentation/13.0/reference/views.html#list – adekock11 Sep 02 '20 at 10:11
0

You can check following link for solution of your problem. web_disable_export_group

If you want to hide Export All button on the top-up header and next to the create method for some views only then follow below step.

<tree string="Account"  export_xlsx="false" create="false">

But if you're using the web_disable_export_group and Did you uncheck the Export Button security group then for that user they are not able to see that Export All button for any views.Reference