mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[IMP] web_disable_export_group: Differenciate between the XLSX export and the standard export
This commit is contained in:
@@ -1,33 +1,15 @@
|
||||
/* Copyright 2016 Onestein
|
||||
Copyright 2018 Tecnativa - David Vidal
|
||||
Copyright 2021 Tecnativa - Alexandre Díaz
|
||||
Copyright 2022 Tecnativa - Víctor Martínez
|
||||
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.WebDisableExportGroupController", function (
|
||||
require
|
||||
) {
|
||||
"use strict";
|
||||
|
||||
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({
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
_addItems: function (sectionCode, items) {
|
||||
let _items = items;
|
||||
if (
|
||||
!session.is_superuser &&
|
||||
sectionCode === "other" &&
|
||||
items.length &&
|
||||
!session.group_export_data
|
||||
) {
|
||||
_items = _.reject(_items, {label: _t("Export")});
|
||||
}
|
||||
this._super(sectionCode, _items);
|
||||
},
|
||||
});
|
||||
|
||||
AbstractController.include({
|
||||
/**
|
||||
@@ -37,8 +19,8 @@ odoo.define("web_disable_export_group", function (require) {
|
||||
if (
|
||||
!session.is_superuser &&
|
||||
action &&
|
||||
action.startsWith("export_") &&
|
||||
!session.group_export_data
|
||||
action.startsWith("export_xlsx") &&
|
||||
!session.group_xlsx_export_data
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
/* Copyright 2020 Tecnativa - João Marques
|
||||
Copyright 2022 Tecnativa - Víctor Martínez
|
||||
License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). */
|
||||
|
||||
odoo.define("web_disable_export_group.tour", function (require) {
|
||||
"use strict";
|
||||
|
||||
var core = require("web.core");
|
||||
var tour = require("web_tour.tour");
|
||||
|
||||
var _t = core._t;
|
||||
|
||||
tour.register(
|
||||
"export_tour_admin",
|
||||
"export_tour_xlsx_button_ok",
|
||||
{
|
||||
test: true,
|
||||
url:
|
||||
@@ -21,25 +19,10 @@ odoo.define("web_disable_export_group.tour", function (require) {
|
||||
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",
|
||||
},
|
||||
{
|
||||
content: "Open actions",
|
||||
trigger: ".o_dropdown_toggler_btn",
|
||||
},
|
||||
{
|
||||
content: "Check if Export button exists",
|
||||
trigger:
|
||||
'.o_cp_action_menus ul.o_dropdown_menu a:contains("' +
|
||||
_t("Export") +
|
||||
'")',
|
||||
},
|
||||
]
|
||||
);
|
||||
tour.register(
|
||||
"export_tour_demo",
|
||||
"export_tour_xlsx_button_ko",
|
||||
{
|
||||
test: true,
|
||||
url:
|
||||
@@ -50,21 +33,6 @@ odoo.define("web_disable_export_group.tour", function (require) {
|
||||
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",
|
||||
},
|
||||
{
|
||||
content: "Open actions",
|
||||
trigger: ".o_dropdown_toggler_btn",
|
||||
},
|
||||
{
|
||||
content: "Check if Export button does not exist",
|
||||
trigger:
|
||||
'.o_cp_action_menus ul.o_dropdown_menu a:first:not(:contains("' +
|
||||
_t("Export") +
|
||||
'"))',
|
||||
},
|
||||
]
|
||||
);
|
||||
return {};
|
||||
|
||||
Reference in New Issue
Block a user