Skip to content

Commit 3a0889e

Browse files
committed
[MIG] web_disable_export_group: Migration to 17.0
1 parent f5b5e41 commit 3a0889e

File tree

12 files changed

+76
-111
lines changed

12 files changed

+76
-111
lines changed

web_disable_export_group/README.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ Contributors
9090
- Víctor Martínez
9191
- David Vidal
9292

93+
- `Jarsa <https://www.jarsa.com>`__:
94+
95+
- Alan Ramos
96+
9397
Maintainers
9498
-----------
9599

web_disable_export_group/__manifest__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@
44
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
55
{
66
"name": "Web Disable Export Group",
7-
"version": "16.0.1.0.0",
7+
"version": "17.0.1.0.0",
88
"license": "AGPL-3",
99
"author": "Onestein, Tecnativa, Odoo Community Association (OCA)",
1010
"website": "https://github.com/OCA/web",
1111
"category": "Web",
1212
"depends": ["web"],
1313
"data": [
1414
"security/groups.xml",
15-
"security/ir.model.access.csv",
1615
],
1716
"installable": True,
1817
"assets": {
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
from . import ir_http
21
from . import models

web_disable_export_group/models/ir_http.py

Lines changed: 0 additions & 20 deletions
This file was deleted.

web_disable_export_group/readme/CONTRIBUTORS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@
77
- Alexandre Díaz
88
- Víctor Martínez
99
- David Vidal
10+
- [Jarsa](https://www.jarsa.com):
11+
- Alan Ramos

web_disable_export_group/security/ir.model.access.csv

Lines changed: 0 additions & 2 deletions
This file was deleted.

web_disable_export_group/static/description/index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,10 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
436436
<li>David Vidal</li>
437437
</ul>
438438
</li>
439+
<li><a class="reference external" href="https://www.jarsa.com">Jarsa</a>:<ul>
440+
<li>Alan Ramos</li>
441+
</ul>
442+
</li>
439443
</ul>
440444
</div>
441445
<div class="section" id="maintainers">

web_disable_export_group/static/src/js/abstract_controller.esm.js

Lines changed: 0 additions & 26 deletions
This file was deleted.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/** @odoo-module **/
2+
3+
import {archParseBoolean} from "@web/views/utils";
4+
import {exportAllItem} from "@web/views/list/export_all/export_all";
5+
import {registry} from "@web/core/registry";
6+
7+
const cogMenuRegistry = registry.category("cogMenu");
8+
9+
// Eliminar el registro anterior
10+
cogMenuRegistry.remove("export-all-menu");
11+
12+
// Clonar el exportAllItem y cambiar la lógica del isDisplayed
13+
const customExportAllItem = {
14+
...exportAllItem,
15+
isDisplayed: async (env) =>
16+
env.config.viewType === "list" &&
17+
!env.model.root.selection.length &&
18+
(await env.model.user.hasGroup(
19+
"web_disable_export_group.group_export_xlsx_data"
20+
)) &&
21+
archParseBoolean(env.config.viewArch.getAttribute("export_xlsx"), true),
22+
};
23+
24+
// Registrar el nuevo item
25+
cogMenuRegistry.add("export-all-menu", customExportAllItem, {sequence: 10});

web_disable_export_group/static/src/js/list_controller.esm.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

web_disable_export_group/static/src/xml/export_xls_views.xml

Lines changed: 0 additions & 17 deletions
This file was deleted.

web_disable_export_group/static/tests/web_disable_export_group_tour.esm.js

Lines changed: 40 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,48 @@
33
Copyright 2022 Tecnativa - Víctor Martínez
44
License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). */
55

6-
import tour from "web_tour.tour";
6+
import {registry} from "@web/core/registry";
77

8-
tour.register(
9-
"export_tour_xlsx_button_ok",
10-
{
11-
test: true,
12-
url: "/web#model=ir.ui.view&view_type=list&cids=&action=base.action_ui_view",
13-
},
14-
[
8+
function openCogMenu() {
9+
return [
1510
{
16-
content: "Check if 'Export all' button exists",
17-
trigger: ".o_list_buttons:has(.o_list_export_xlsx)",
11+
content: "Click the cog icon to open the action menu",
12+
trigger: ".o_cp_action_menus .o-dropdown .dropdown-toggle",
13+
run: "click",
1814
},
19-
]
20-
);
21-
tour.register(
22-
"export_tour_xlsx_button_ko",
23-
{
24-
test: true,
25-
url: "/web#model=ir.ui.view&view_type=list&cids=&action=base.action_ui_view",
26-
},
27-
[
2815
{
29-
content: "Check if 'Export all' button exists",
30-
trigger: ".o_list_buttons:not(:has(.o_list_export_xlsx))",
16+
content: "Wait for the dropdown menu to be visible",
17+
trigger: ".o-dropdown--menu.dropdown-menu.show, .o-dropdown--menu.d-block",
3118
},
32-
]
33-
);
19+
];
20+
}
21+
22+
registry.category("web_tour.tours").add("export_tour_xlsx_button_ok", {
23+
test: true,
24+
url: "/web#model=ir.ui.view&view_type=list&action=base.action_ui_view",
25+
steps: () => [
26+
...openCogMenu(),
27+
{
28+
content: "Check that the 'Export All' button is visible",
29+
trigger: ".dropdown-item.o_export_all_menu",
30+
run: () => {
31+
// Intentionally left blank
32+
},
33+
},
34+
],
35+
});
36+
37+
registry.category("web_tour.tours").add("export_tour_xlsx_button_ko", {
38+
test: true,
39+
url: "/web#model=ir.ui.view&view_type=list&action=base.action_ui_view",
40+
steps: () => [
41+
...openCogMenu(),
42+
{
43+
content: "Check that the 'Export All' button is NOT visible",
44+
trigger: ".o_cp_action_menus:not(:has(.o_export_all_menu))",
45+
run: () => {
46+
// Intentionally left blank
47+
},
48+
},
49+
],
50+
});

0 commit comments

Comments
 (0)