mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[IMP] web_disable_export_group: Disable 'export all' button
This commit is contained in:
@@ -1,17 +1,22 @@
|
||||
/* Copyright 2016 Onestein
|
||||
Copyright 2018 Tecnativa - David Vidal
|
||||
Copyright 2021 Tecnativa - Alexandre Díaz
|
||||
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";
|
||||
|
||||
var core = require("web.core");
|
||||
var Sidebar = require("web.Sidebar");
|
||||
var session = require("web.session");
|
||||
var _t = core._t;
|
||||
const core = require("web.core");
|
||||
const Sidebar = require("web.Sidebar");
|
||||
const session = require("web.session");
|
||||
const AbstractController = require("web.AbstractController");
|
||||
const _t = core._t;
|
||||
|
||||
Sidebar.include({
|
||||
_addItems: function(sectionCode, items) {
|
||||
var _items = items;
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
_addItems: function (sectionCode, items) {
|
||||
let _items = items;
|
||||
if (
|
||||
!session.is_superuser &&
|
||||
sectionCode === "other" &&
|
||||
@@ -23,4 +28,22 @@ odoo.define("web_disable_export_group", function(require) {
|
||||
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);
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* Copyright 2020 Tecnativa - João Marques
|
||||
License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). */
|
||||
|
||||
odoo.define("web_disable_export_group.tour", function(require) {
|
||||
odoo.define("web_disable_export_group.tour", function (require) {
|
||||
"use strict";
|
||||
|
||||
var core = require("web.core");
|
||||
@@ -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",
|
||||
},
|
||||
[
|
||||
{
|
||||
content: "Check if 'Export all' button exists",
|
||||
trigger: ".o_list_buttons:has(.o_list_export_xlsx)",
|
||||
},
|
||||
{
|
||||
content: "Select all records",
|
||||
trigger: ".custom-control-input:first",
|
||||
@@ -28,7 +32,7 @@ odoo.define("web_disable_export_group.tour", function(require) {
|
||||
{
|
||||
content: "Check if Export button exists",
|
||||
trigger:
|
||||
'.o_control_panel div.o_dropdown_menu a:contains("' +
|
||||
'.o_cp_action_menus ul.o_dropdown_menu a:contains("' +
|
||||
_t("Export") +
|
||||
'")',
|
||||
},
|
||||
@@ -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",
|
||||
},
|
||||
[
|
||||
{
|
||||
content: "Check if 'Export all' button exists",
|
||||
trigger: ".o_list_buttons:not(:has(.o_list_export_xlsx))",
|
||||
},
|
||||
{
|
||||
content: "Select all records",
|
||||
trigger: ".custom-control-input:first",
|
||||
@@ -53,7 +61,7 @@ odoo.define("web_disable_export_group.tour", function(require) {
|
||||
{
|
||||
content: "Check if Export button does not exist",
|
||||
trigger:
|
||||
'.o_control_panel div.o_dropdown_menu a:first:not(:contains("' +
|
||||
'.o_cp_action_menus ul.o_dropdown_menu a:first:not(:contains("' +
|
||||
_t("Export") +
|
||||
'"))',
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user