Odoo - OpenERP - How to hide ‘Export’ Option (More > Export) in Odoo for single user or all users ?

Support
Support
5000
| 2 1 2
Asked on 9/9/15, 3:25 PM
0
vote
3814 Views

A) Allowing Export option to a single user:

Steps to be followed:-

1. Create XML File Under **static/src/base.xml** in your module and add this code below:
  

<templates>

            <t t-extend=”Sidebar”>
                <t t-jquery=”a.oe_sidebar_action_a” t-operation=”replace”>
                    <t t-if=”widget.session.uid !== 1″>
                    <a t-if=”item.label !== ‘Export'” class=”oe_sidebar_action_a” t-att-title=”item.title or ”” t-att-data-section=”section.name” t-att-data-index=”item_index” t-att-href=”item.url” target=”_blank”>
                         <t t-raw=”item.label”/>
                     </a>
                    </t>
                    <t t-if=”widget.session.uid === 1″>
                        <a class=”oe_sidebar_action_a” t-att-title=”item.title or ”” t-att-data-section=”section.name” t-att-data-index=”item_index” t-att-href=”item.url” target=”_blank”>
                             <t t-raw=”item.label”/>
                        </a>
                    </t>
                </t>
            </t>
    </templates>

2.  Add this in File **__Odoo__.py**:

‘qweb': [
“static/src/base.xml”,

]

3. Finally restart te services and refresh the page.

 

Eg. If uid of say admin is 1.So if we pass uid ===1 in the template shown above then it means that Exportoption would be visible to admin and no other user will be able to see the Export option.

ways-to-hide-Export-Option-Odoo

For some other user say warehouseExport is not visible.

export-not-visible

 

B) Not Allowing Export option to any user (even the admin):

Changes to be made:

1) Go to web (default) module in static>src>js>view_list.js

2) Comment the below line in view_list.js file

——–{ label: _t(“Export”), callback: this.on_sidebar_export },

Export option before hidding

export-before-hidding

Export option after making changes

export-after-changing

 

C) Allowing Export option only when the user has a delete access:

1) Go to web (default) module in static>src>js>view_list.js

2) Add self.is_action_enabled(‘delete’) & before { label: _t(“Export”), callback: this.on_sidebar_export }-This changes will allow the user to export the data only when they have a delete access on that particular object.

Say, User1 has a delete access for ‘sale.order’ object then he may also Export the data of ‘sale.order’ and if the same user1 doesn’t have a delete access on ‘account.invoice’ object then Export is not allowed for ‘account.invoice’ in More option.

–>>>If no “Delete” access then no “Export” option

delete-export-yes

—->If “Delete” access then “Export” option visible

delete-export-no

Support
Support
5000
| 2 1 2
Answered on 9/9/15, 3:26 PM
0
vote

Your answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

Ask a Question

Keep Informed

About This Forum

This forum is for HiTechnologia Employees & just Odoo general knowledge purpose only.

Read Guidelines

Question tools

3 follower(s)

Stats

Asked: 9/9/15, 3:25 PM
Seen: 3814 times
Last updated: 9/9/15, 3:26 PM