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.
For some other user say warehouse, Export is 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 option after making changes
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
—->If “Delete” access then “Export” option visible
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!
Keep Informed
About This Forum
This forum is for HiTechnologia Employees & just Odoo general knowledge purpose only.
Read GuidelinesQuestion tools
Stats
Asked: 9/9/15, 3:25 PM |
Seen: 7489 times |
Last updated: 9/9/15, 3:26 PM |