Shridhar Ivani
Shridhar Ivani

Reputation: 467

How to remove Create and Import here in odoo

I have following module in this module I wanted it to display in Form view .I dont have any records fields too just some single line diagram we have added at .xml file and that is static

enter image description here

Upvotes: 1

Views: 3048

Answers (2)

Federico Baù
Federico Baù

Reputation: 7665

Un update for this Question as the Current Odoo's version is 14.0.0

Another way to just remove (or add) Create & Import is to act directly on the XML view of the Tree.

To toggle Create & Import, on the tree view use these attributes

<record id="model_name_view_tree" model="ir.ui.view">
    <field name="name">model.name.view.tree</field>
    <field name="model">model.name</field>    
    <field name="arch" type="xml">
       <tree string="My Tree View" create="false" import="false">
            <!--   Data....      -->
        </tree>

    </field>
</record>

However, if you disable create (create="false") it will disable import as well as you can't create new records (importing you will create new record right?) so you could just put `create=false'


Toggle Create & Import from an existing View (inheriting)

<record id="model_name_view_tree" model="ir.ui.view">
    <field name="name">model.name.view.tree</field>
    <field name="model">model.name</field>
    <field name="inherit_id" ref="module_name.model_name_inherited"/>
    <field name="priority">50</field> <!-- Higher priority means lower hierarchy, adviced to add it | Default 16 -->
    <field name="arch" type="xml">
       <tree string="My Tree View" create="false" import="false">
            <!--   Data....      -->
        </tree>

    </field>
</record>

Odoo Documentation

Upvotes: 0

Bhavesh Odedra
Bhavesh Odedra

Reputation: 11143

You need to add security file in your custom module.

For example: security/ir.model.access.csv

id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
unique_id, test.name, model_test_name, group_name_test_user, 1,1,0,0

For import link you may follow openerp-import-and-export-menu-not-shown

You need to make it False

NOTE:

Don't forget to add file in openerp.py file

Upvotes: 2

Related Questions