mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[MIG] web_disable_export_group: Migration to 16.0
TT45881
This commit is contained in:
@@ -1,19 +1,20 @@
|
||||
/** @odoo-module **/
|
||||
/* Copyright 2018 Tecnativa - David Vidal
|
||||
License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). */
|
||||
import ListController from "web.ListController";
|
||||
import session from "web.session";
|
||||
import {ListController} from "@web/views/list/list_controller";
|
||||
import {onWillStart} from "@odoo/owl";
|
||||
import {patch} from "@web/core/utils/patch";
|
||||
|
||||
ListController.include({
|
||||
init() {
|
||||
patch(ListController.prototype, "disable_export_group", {
|
||||
setup() {
|
||||
this._super(...arguments);
|
||||
this.isExportXlsEnable = false;
|
||||
},
|
||||
async willStart() {
|
||||
const res = await this._super(...arguments);
|
||||
this.isExportXlsEnable = await session.user_has_group(
|
||||
"web_disable_export_group.group_export_xlsx_data"
|
||||
);
|
||||
return res;
|
||||
onWillStart(async () => {
|
||||
this.isExportEnable = await this.userService.hasGroup(
|
||||
"base.group_allow_export"
|
||||
);
|
||||
this.isExportXlsEnable = await this.userService.hasGroup(
|
||||
"web_disable_export_group.group_export_xlsx_data"
|
||||
);
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
/** @odoo-module **/
|
||||
/* 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). */
|
||||
|
||||
import tour from "web_tour.tour";
|
||||
|
||||
tour.register(
|
||||
"export_tour_xlsx_button_ok",
|
||||
{
|
||||
test: true,
|
||||
url: "/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)",
|
||||
},
|
||||
]
|
||||
);
|
||||
tour.register(
|
||||
"export_tour_xlsx_button_ko",
|
||||
{
|
||||
test: true,
|
||||
url: "/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))",
|
||||
},
|
||||
]
|
||||
);
|
||||
@@ -1,12 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<templates>
|
||||
|
||||
<t t-extend="ListView.buttons">
|
||||
<t t-jquery="t[t-if*='widget.isExportEnable']" t-operation="attributes">
|
||||
<t
|
||||
t-name="web.ListView.Buttons.disbaleExport"
|
||||
t-inherit="web.ListView.Buttons"
|
||||
t-inherit-mode="extension"
|
||||
owl="1"
|
||||
>
|
||||
<xpath expr="//t[contains(@t-if, 'isExportEnable')]" position="attributes">
|
||||
<attribute
|
||||
name="t-if"
|
||||
>widget.is_action_enabled('export_xlsx') and widget.isExportXlsEnable</attribute>
|
||||
</t>
|
||||
>nbTotal and !nbSelected and activeActions.exportXlsx and isExportXlsEnable and !env.isSmall</attribute>
|
||||
</xpath>
|
||||
</t>
|
||||
|
||||
</templates>
|
||||
|
||||
Reference in New Issue
Block a user