Help

2

[odoo10] : How can we hide the export button for specific tree view?

Hello All,

Is it possible to hide the Export button from the Action drop down menu list for the specific model and view?

Here is the screenshot.



Edit : 17-11-2017.

Here is the solution I've tried but was not work, after following the link reference provided.

JS File

odoo.define('my_module.PortalManagement', function (require) {
"use strict";
var core = require('web.core'); var Model = require('web.Model'); var Sidebar = require('web.Sidebar') Sidebar.include({ init: function () { var self = this; var ids; this._super.apply(this, arguments); self.view = self.getParent(); }, add_items: function (section_code, items) { var UserModel = new Model('res.users'); UserModel.call('has_group', ['mm_portal_user_management.user_area_manager']).done(function (has_user_portal_mgmt) { alert(has_user_portal_mgmt) if (has_user_portal_mgmt === true) { var new_items = []; for (var i = 0; i < items.length; i++) { if (items[i]['label'] != "Export") { new_items.push(items[i]); }; }; return self._super.call(this, section_code, new_items); } else { this._super.apply(this, arguments); } }); }, });
});

XML FILE


<?xml version="1.0" encoding="utf-8"?>

<odoo> <template id="assets_backend_export" name="Portal Export Assets" inherit_id="web.assets_backend"> <xpath expr="." position="inside"> <script type="text/javascript" src="/my_module/static/src/js/disable_export.js"></script> </xpath> </template> 

</odoo> 


 This is the code I've applied to check for the specific user group assigned to user to overcome the the issue, but was not working well.

I got the following error.




Neither call or apply function is callable inside add_items() method. does any one has idea how could be resolve this error?

Regards,

Anil.

1 Comment
Avatar
Discard
2 Answers
3
Avatar
Niyas Raphy
Best Answer

Hi Anil,

Please check this module , This will help to hide the export button based on user groups.

https://www.odoo.com/apps/modules/10.0/web_disable_export_group/

Thanks

1 Comment
Avatar
Discard

Hi Niyas, Your solution and logic helped me thanks. I modified and used it on my way. very helpful link.

2
Avatar
Boubaker Abdallah
Best Answer

Just follow the steps given in the blog: 

http://change-openerp-web.blogspot.in/2013/08/hide-export-in-more-option-in-openerp-7.html 

https://stackoverflow.com/questions/38005794/hide-delete-button-from-export-data-form-view-in-odoo


1 Comment
Avatar
Discard

Thanks Bouabaker for quick response :), let me try the steps