forked from Techsystech/web
[IMP] web_disable_export_group: Disable 'export all' button
parent
11e2a51e16
commit
95c87cd539
|
@ -26,10 +26,10 @@ Web Disable Export Group
|
||||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||||
|
|
||||||
In the standard Odoo the UI option 'Export' that is present in the 'Action' menu
|
In the standard Odoo the UI option 'Export' that is present in the 'Action' menu
|
||||||
of any list view is always enabled (for every user).
|
and the 'Export All' button of any list view is always enabled (for every user).
|
||||||
|
|
||||||
This module makes the option 'Export' enabled only for the users that belong
|
This module makes the option 'Export' and 'Export All' enabled only for the users
|
||||||
to the Export Data group.
|
that belong to the Export Data group.
|
||||||
|
|
||||||
Admin user can always use the export option.
|
Admin user can always use the export option.
|
||||||
|
|
||||||
|
@ -80,6 +80,7 @@ Contributors
|
||||||
|
|
||||||
* David Vidal
|
* David Vidal
|
||||||
* João Marques
|
* João Marques
|
||||||
|
* Alexandre Díaz
|
||||||
|
|
||||||
Maintainers
|
Maintainers
|
||||||
~~~~~~~~~~~
|
~~~~~~~~~~~
|
||||||
|
|
|
@ -7,3 +7,4 @@
|
||||||
|
|
||||||
* David Vidal
|
* David Vidal
|
||||||
* João Marques
|
* João Marques
|
||||||
|
* Alexandre Díaz
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
In the standard Odoo the UI option 'Export' that is present in the 'Action' menu
|
In the standard Odoo the UI option 'Export' that is present in the 'Action' menu
|
||||||
of any list view is always enabled (for every user).
|
and the 'Export All' button of any list view is always enabled (for every user).
|
||||||
|
|
||||||
This module makes the option 'Export' enabled only for the users that belong
|
This module makes the option 'Export' and 'Export All' enabled only for the users
|
||||||
to the Export Data group.
|
that belong to the Export Data group.
|
||||||
|
|
||||||
Admin user can always use the export option.
|
Admin user can always use the export option.
|
||||||
|
|
|
@ -369,9 +369,9 @@ ul.auto-toc {
|
||||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||||
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/web/tree/13.0/web_disable_export_group"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/web-13-0/web-13-0-web_disable_export_group"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/162/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/web/tree/13.0/web_disable_export_group"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/web-13-0/web-13-0-web_disable_export_group"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/162/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||||
<p>In the standard Odoo the UI option ‘Export’ that is present in the ‘Action’ menu
|
<p>In the standard Odoo the UI option ‘Export’ that is present in the ‘Action’ menu
|
||||||
of any list view is always enabled (for every user).</p>
|
and the ‘Export All’ button of any list view is always enabled (for every user).</p>
|
||||||
<p>This module makes the option ‘Export’ enabled only for the users that belong
|
<p>This module makes the option ‘Export’ and ‘Export All’ enabled only for the users
|
||||||
to the Export Data group.</p>
|
that belong to the Export Data group.</p>
|
||||||
<p>Admin user can always use the export option.</p>
|
<p>Admin user can always use the export option.</p>
|
||||||
<p><strong>Table of contents</strong></p>
|
<p><strong>Table of contents</strong></p>
|
||||||
<div class="contents local topic" id="contents">
|
<div class="contents local topic" id="contents">
|
||||||
|
@ -424,6 +424,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
|
||||||
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
|
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
|
||||||
<li>David Vidal</li>
|
<li>David Vidal</li>
|
||||||
<li>João Marques</li>
|
<li>João Marques</li>
|
||||||
|
<li>Alexandre Díaz</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -1,17 +1,22 @@
|
||||||
/* Copyright 2016 Onestein
|
/* Copyright 2016 Onestein
|
||||||
Copyright 2018 Tecnativa - David Vidal
|
Copyright 2018 Tecnativa - David Vidal
|
||||||
|
Copyright 2021 Tecnativa - Alexandre Díaz
|
||||||
License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). */
|
License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). */
|
||||||
odoo.define("web_disable_export_group", function(require) {
|
odoo.define("web_disable_export_group", function(require) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var core = require("web.core");
|
const core = require("web.core");
|
||||||
var Sidebar = require("web.Sidebar");
|
const Sidebar = require("web.Sidebar");
|
||||||
var session = require("web.session");
|
const session = require("web.session");
|
||||||
var _t = core._t;
|
const AbstractController = require("web.AbstractController");
|
||||||
|
const _t = core._t;
|
||||||
|
|
||||||
Sidebar.include({
|
Sidebar.include({
|
||||||
|
/**
|
||||||
|
* @override
|
||||||
|
*/
|
||||||
_addItems: function(sectionCode, items) {
|
_addItems: function(sectionCode, items) {
|
||||||
var _items = items;
|
let _items = items;
|
||||||
if (
|
if (
|
||||||
!session.is_superuser &&
|
!session.is_superuser &&
|
||||||
sectionCode === "other" &&
|
sectionCode === "other" &&
|
||||||
|
@ -23,4 +28,22 @@ odoo.define("web_disable_export_group", function(require) {
|
||||||
this._super(sectionCode, _items);
|
this._super(sectionCode, _items);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
AbstractController.include({
|
||||||
|
/**
|
||||||
|
* @override
|
||||||
|
*/
|
||||||
|
is_action_enabled: function(action) {
|
||||||
|
if (
|
||||||
|
!session.is_superuser &&
|
||||||
|
action &&
|
||||||
|
action.startsWith("export_") &&
|
||||||
|
!session.group_export_data
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this._super.apply(this, arguments);
|
||||||
|
},
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -17,6 +17,10 @@ odoo.define("web_disable_export_group.tour", function(require) {
|
||||||
"/web#model=ir.ui.view&view_type=list&cids=&action=base.action_ui_view",
|
"/web#model=ir.ui.view&view_type=list&cids=&action=base.action_ui_view",
|
||||||
},
|
},
|
||||||
[
|
[
|
||||||
|
{
|
||||||
|
content: "Check if 'Export all' button exists",
|
||||||
|
trigger: ".o_list_buttons:has(.o_list_export_xlsx)",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
content: "Select all records",
|
content: "Select all records",
|
||||||
trigger: ".custom-control-input:first",
|
trigger: ".custom-control-input:first",
|
||||||
|
@ -42,6 +46,10 @@ odoo.define("web_disable_export_group.tour", function(require) {
|
||||||
"/web#model=ir.ui.view&view_type=list&cids=&action=base.action_ui_view",
|
"/web#model=ir.ui.view&view_type=list&cids=&action=base.action_ui_view",
|
||||||
},
|
},
|
||||||
[
|
[
|
||||||
|
{
|
||||||
|
content: "Check if 'Export all' button exists",
|
||||||
|
trigger: ".o_list_buttons:not(:has(.o_list_export_xlsx))",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
content: "Select all records",
|
content: "Select all records",
|
||||||
trigger: ".custom-control-input:first",
|
trigger: ".custom-control-input:first",
|
||||||
|
|
Loading…
Reference in New Issue