From 111944e008c369979229c4ac2b8e42a526b0ced7 Mon Sep 17 00:00:00 2001 From: David Date: Mon, 4 Mar 2024 17:48:12 +0100 Subject: [PATCH] [MIG] web_disable_export_group: Migration to 16.0 TT45881 --- .../odoo/addons/web_disable_export_group | 1 + setup/web_disable_export_group/setup.py | 6 +++++ web_disable_export_group/README.rst | 12 ++++----- web_disable_export_group/__manifest__.py | 9 ++++--- .../static/description/index.html | 8 +++--- .../static/src/js/list_controller.esm.js | 25 ++++++++++--------- .../static/src/xml/export_xls_views.xml | 13 +++++++--- .../web_disable_export_group_tour.esm.js | 0 web_disable_export_group/tests/test_tour.py | 6 +++-- 9 files changed, 48 insertions(+), 32 deletions(-) create mode 120000 setup/web_disable_export_group/odoo/addons/web_disable_export_group create mode 100644 setup/web_disable_export_group/setup.py rename web_disable_export_group/static/{src/tours => tests}/web_disable_export_group_tour.esm.js (100%) diff --git a/setup/web_disable_export_group/odoo/addons/web_disable_export_group b/setup/web_disable_export_group/odoo/addons/web_disable_export_group new file mode 120000 index 000000000..d8a2f35c1 --- /dev/null +++ b/setup/web_disable_export_group/odoo/addons/web_disable_export_group @@ -0,0 +1 @@ +../../../../web_disable_export_group \ No newline at end of file diff --git a/setup/web_disable_export_group/setup.py b/setup/web_disable_export_group/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/web_disable_export_group/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/web_disable_export_group/README.rst b/web_disable_export_group/README.rst index c001e0e65..3a562de72 100644 --- a/web_disable_export_group/README.rst +++ b/web_disable_export_group/README.rst @@ -7,7 +7,7 @@ Web Disable Export Group !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:3f87e644dfcdd8674f909e10611703748bf60635999074fcd231cd8fc4bff4ea + !! source digest: sha256:53eeef451e7dbe8a9904efe9a17051a08f19242c695fd057ea6cde108866f101 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png @@ -17,13 +17,13 @@ Web Disable Export Group :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github - :target: https://github.com/OCA/web/tree/15.0/web_disable_export_group + :target: https://github.com/OCA/web/tree/16.0/web_disable_export_group :alt: OCA/web .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/web-15-0/web-15-0-web_disable_export_group + :target: https://translation.odoo-community.org/projects/web-16-0/web-16-0-web_disable_export_group :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png - :target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=15.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=16.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| @@ -60,7 +60,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -102,6 +102,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -This module is part of the `OCA/web `_ project on GitHub. +This module is part of the `OCA/web `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/web_disable_export_group/__manifest__.py b/web_disable_export_group/__manifest__.py index f4692f43b..f086e834e 100644 --- a/web_disable_export_group/__manifest__.py +++ b/web_disable_export_group/__manifest__.py @@ -4,7 +4,7 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { "name": "Web Disable Export Group", - "version": "15.0.2.0.0", + "version": "16.0.1.0.0", "license": "AGPL-3", "author": "Onestein, Tecnativa, Odoo Community Association (OCA)", "website": "https://github.com/OCA/web", @@ -16,8 +16,9 @@ ], "installable": True, "assets": { - "web.assets_backend": ["/web_disable_export_group/static/src/js/*.js"], - "web.assets_tests": ["/web_disable_export_group/static/src/tours/*.js"], - "web.assets_qweb": ["/web_disable_export_group/static/src/xml/**/*"], + "web.assets_backend": [ + "/web_disable_export_group/static/src/**/*", + ], + "web.assets_tests": ["/web_disable_export_group/static/tests/*.js"], }, } diff --git a/web_disable_export_group/static/description/index.html b/web_disable_export_group/static/description/index.html index 3f93df52b..349bcf074 100644 --- a/web_disable_export_group/static/description/index.html +++ b/web_disable_export_group/static/description/index.html @@ -367,9 +367,9 @@ ul.auto-toc { !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:3f87e644dfcdd8674f909e10611703748bf60635999074fcd231cd8fc4bff4ea +!! source digest: sha256:53eeef451e7dbe8a9904efe9a17051a08f19242c695fd057ea6cde108866f101 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/web Translate me on Weblate Try me on Runboat

+

Beta License: AGPL-3 OCA/web Translate me on Weblate Try me on Runboat

The standard grants/prevents access to any UI export via Access to export feature group.

This module adds a new group for the ‘Direct Export (xlsx)’ feature, leaving the @@ -407,7 +407,7 @@ from the list view.

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -feedback.

+feedback.

Do not contact contributors directly about support or help with technical issues.

@@ -444,7 +444,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

-

This module is part of the OCA/web project on GitHub.

+

This module is part of the OCA/web project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

diff --git a/web_disable_export_group/static/src/js/list_controller.esm.js b/web_disable_export_group/static/src/js/list_controller.esm.js index a38c4decf..8e99b9148 100644 --- a/web_disable_export_group/static/src/js/list_controller.esm.js +++ b/web_disable_export_group/static/src/js/list_controller.esm.js @@ -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" + ); + }); }, }); diff --git a/web_disable_export_group/static/src/xml/export_xls_views.xml b/web_disable_export_group/static/src/xml/export_xls_views.xml index 84fecc27a..236efcb32 100644 --- a/web_disable_export_group/static/src/xml/export_xls_views.xml +++ b/web_disable_export_group/static/src/xml/export_xls_views.xml @@ -1,12 +1,17 @@ - - + + widget.is_action_enabled('export_xlsx') and widget.isExportXlsEnable - + >nbTotal and !nbSelected and activeActions.exportXlsx and isExportXlsEnable and !env.isSmall + diff --git a/web_disable_export_group/static/src/tours/web_disable_export_group_tour.esm.js b/web_disable_export_group/static/tests/web_disable_export_group_tour.esm.js similarity index 100% rename from web_disable_export_group/static/src/tours/web_disable_export_group_tour.esm.js rename to web_disable_export_group/static/tests/web_disable_export_group_tour.esm.js diff --git a/web_disable_export_group/tests/test_tour.py b/web_disable_export_group/tests/test_tour.py index 9bfaf27e7..854eb9b49 100644 --- a/web_disable_export_group/tests/test_tour.py +++ b/web_disable_export_group/tests/test_tour.py @@ -19,8 +19,10 @@ class TestTour(odoo.tests.HttpCase): self.env, login="user_export_xlsx", password="user_export_xlsx", - groups="base.group_user,base.group_system,%s" - % ("web_disable_export_group.group_export_xlsx_data"), + groups=( + "base.group_user,base.group_system," + "web_disable_export_group.group_export_xlsx_data" + ), ) def test_admin(self):