Merge pull request #1164 from Tecnativa/11.0-imp-web_export_view_security

[11.0] web_export_view: add security group
pull/1181/head
Pedro M. Baeza 2019-01-22 14:48:23 +01:00 committed by GitHub
commit c360e3056f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 5 deletions

View File

@ -16,6 +16,11 @@ A lot of customers want simply to export the tree view they are looking to.
If you miss this feature as us, probably you'll find an answer into our If you miss this feature as us, probably you'll find an answer into our
web_export_view module. web_export_view module.
Configuration
=============
If we wanted to disallow users to use the features provided by this module, we
can add them to the group *Disallow Export View Data to Excel*.
Usage Usage
===== =====
@ -60,6 +65,7 @@ Contributors
* Stefan Rijnhart <stefan@therp.nl> * Stefan Rijnhart <stefan@therp.nl>
* Leonardo Pistone <leonardo.pistone@camptocamp.com> * Leonardo Pistone <leonardo.pistone@camptocamp.com>
* Jose Maria Bernet <josemaria.bernet@guadaltech.es> * Jose Maria Bernet <josemaria.bernet@guadaltech.es>
* David Vidal <david.vidal@tecnativa.com>
Maintainer Maintainer
---------- ----------

View File

@ -1,13 +1,14 @@
# Copyright 2016 Henry Zhou (http://www.maxodoo.com)
# Copyright 2016 Rodney (http://clearcorp.cr/)
# Copyright 2012 Agile Business Group # Copyright 2012 Agile Business Group
# Copyright 2012 Domsense srl (<http://www.domsense.com>) # Copyright 2012 Domsense srl (<http://www.domsense.com>)
# Copyright 2012 Therp BV # Copyright 2012 Therp BV
# Copyright 2016 Henry Zhou (http://www.maxodoo.com)
# Copyright 2016 Rodney (http://clearcorp.cr/)
# Copyright 2019 Tecnativa
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{ {
'name': 'Web Export Current View', 'name': 'Web Export Current View',
'version': '11.0.1.0.0', 'version': '11.0.2.0.0',
'category': 'Web', 'category': 'Web',
'author': 'Henry Zhou, Agile Business Group, \ 'author': 'Henry Zhou, Agile Business Group, \
Odoo Community Association (OCA)', Odoo Community Association (OCA)',
@ -17,11 +18,13 @@
'web', 'web',
], ],
"data": [ "data": [
'security/groups.xml',
'views/web_export_view_view.xml', 'views/web_export_view_view.xml',
], ],
'qweb': [ 'qweb': [
"static/src/xml/web_export_view_template.xml", "static/src/xml/web_export_view_template.xml",
], ],
'installable': True, 'installable': True,
'auto_install': False, 'auto_install': False,
} }

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="group_disallow_export_view_data_excel" model="res.groups">
<field name="name">Disallow Export View Data to Excel</field>
<field name="category_id" ref="base.module_category_hidden"/>
</record>
</odoo>

View File

@ -16,8 +16,12 @@ odoo.define('web_export_view', function (require) {
var self = this; var self = this;
this._super.apply(this, arguments); this._super.apply(this, arguments);
if (self.getParent().renderer.viewType == 'list') { if (self.getParent().renderer.viewType == 'list') {
self.$el.find('.o_dropdown').last().append(QWeb.render('WebExportTreeViewXls', {widget: self})); session.user_has_group('web_export_view.group_disallow_export_view_data_excel').then(function (has_group) {
self.$el.find('.export_treeview_xls').on('click', self.on_sidebar_export_treeview_xls); if (!has_group) {
self.$el.find('.o_dropdown').last().append(QWeb.render('WebExportTreeViewXls', { widget: self }));
self.$el.find('.export_treeview_xls').on('click', self.on_sidebar_export_treeview_xls);
}
});
} }
}, },