mirror of https://github.com/OCA/web.git
[IMP] web_disable_export_group: Disable 'export all' button
parent
94d5d0cf37
commit
43f366352a
|
@ -14,22 +14,22 @@ 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/13.0/web_disable_export_group
|
||||
:target: https://github.com/OCA/web/tree/14.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-13-0/web-13-0-web_disable_export_group
|
||||
:target: https://translation.odoo-community.org/projects/web-14-0/web-14-0-web_disable_export_group
|
||||
:alt: Translate me on Weblate
|
||||
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
|
||||
:target: https://runbot.odoo-community.org/runbot/162/13.0
|
||||
:target: https://runbot.odoo-community.org/runbot/162/14.0
|
||||
:alt: Try me on Runbot
|
||||
|
||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||
|
||||
In the standard Odoo the UI option 'Export' that is present in the 'Action' menu
|
||||
of any list view is always enabled (for every user).
|
||||
and the 'Export All' button of any list view is always enabled (for every user).
|
||||
|
||||
This module makes the option 'Export' enabled only for the users that belong
|
||||
to the Export Data group.
|
||||
This module makes the option 'Export' and 'Export All' enabled only for the users
|
||||
that belong to the Export Data group.
|
||||
|
||||
Admin user can always use the export option.
|
||||
|
||||
|
@ -55,7 +55,7 @@ Bug Tracker
|
|||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_.
|
||||
In case of trouble, please check there if your issue has already been reported.
|
||||
If you spotted it first, help us smashing it by providing a detailed and welcomed
|
||||
`feedback <https://github.com/OCA/web/issues/new?body=module:%20web_disable_export_group%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||
`feedback <https://github.com/OCA/web/issues/new?body=module:%20web_disable_export_group%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||
|
||||
Do not contact contributors directly about support or help with technical issues.
|
||||
|
||||
|
@ -80,6 +80,7 @@ Contributors
|
|||
|
||||
* David Vidal
|
||||
* João Marques
|
||||
* Alexandre Díaz
|
||||
|
||||
Maintainers
|
||||
~~~~~~~~~~~
|
||||
|
@ -94,6 +95,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 <https://github.com/OCA/web/tree/13.0/web_disable_export_group>`_ project on GitHub.
|
||||
This module is part of the `OCA/web <https://github.com/OCA/web/tree/14.0/web_disable_export_group>`_ project on GitHub.
|
||||
|
||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 13.0\n"
|
||||
"Project-Id-Version: Odoo Server 14.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
|
@ -13,6 +13,11 @@ msgstr ""
|
|||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: web_disable_export_group
|
||||
#: model:ir.model.fields,field_description:web_disable_export_group.field_ir_http__display_name
|
||||
msgid "Display Name"
|
||||
msgstr ""
|
||||
|
||||
#. module: web_disable_export_group
|
||||
#. openerp-web
|
||||
#: code:addons/web_disable_export_group/static/src/js/disable_export_group.js:0
|
||||
|
@ -31,3 +36,13 @@ msgstr ""
|
|||
#: model:ir.model,name:web_disable_export_group.model_ir_http
|
||||
msgid "HTTP Routing"
|
||||
msgstr ""
|
||||
|
||||
#. module: web_disable_export_group
|
||||
#: model:ir.model.fields,field_description:web_disable_export_group.field_ir_http__id
|
||||
msgid "ID"
|
||||
msgstr ""
|
||||
|
||||
#. module: web_disable_export_group
|
||||
#: model:ir.model.fields,field_description:web_disable_export_group.field_ir_http____last_update
|
||||
msgid "Last Modified on"
|
||||
msgstr ""
|
||||
|
|
|
@ -7,3 +7,4 @@
|
|||
|
||||
* David Vidal
|
||||
* João Marques
|
||||
* Alexandre Díaz
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
In the standard Odoo the UI option 'Export' that is present in the 'Action' menu
|
||||
of any list view is always enabled (for every user).
|
||||
and the 'Export All' button of any list view is always enabled (for every user).
|
||||
|
||||
This module makes the option 'Export' enabled only for the users that belong
|
||||
to the Export Data group.
|
||||
This module makes the option 'Export' and 'Export All' enabled only for the users
|
||||
that belong to the Export Data group.
|
||||
|
||||
Admin user can always use the export option.
|
||||
|
|
|
@ -367,11 +367,11 @@ ul.auto-toc {
|
|||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/web/tree/13.0/web_disable_export_group"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/web-13-0/web-13-0-web_disable_export_group"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/162/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/web/tree/14.0/web_disable_export_group"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/web-14-0/web-14-0-web_disable_export_group"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/162/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||
<p>In the standard Odoo the UI option ‘Export’ that is present in the ‘Action’ menu
|
||||
of any list view is always enabled (for every user).</p>
|
||||
<p>This module makes the option ‘Export’ enabled only for the users that belong
|
||||
to the Export Data group.</p>
|
||||
and the ‘Export All’ button of any list view is always enabled (for every user).</p>
|
||||
<p>This module makes the option ‘Export’ and ‘Export All’ enabled only for the users
|
||||
that belong to the Export Data group.</p>
|
||||
<p>Admin user can always use the export option.</p>
|
||||
<p><strong>Table of contents</strong></p>
|
||||
<div class="contents local topic" id="contents">
|
||||
|
@ -401,7 +401,7 @@ make use of the option ‘Export’.</p>
|
|||
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/web/issues">GitHub Issues</a>.
|
||||
In case of trouble, please check there if your issue has already been reported.
|
||||
If you spotted it first, help us smashing it by providing a detailed and welcomed
|
||||
<a class="reference external" href="https://github.com/OCA/web/issues/new?body=module:%20web_disable_export_group%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||
<a class="reference external" href="https://github.com/OCA/web/issues/new?body=module:%20web_disable_export_group%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
||||
</div>
|
||||
<div class="section" id="credits">
|
||||
|
@ -424,6 +424,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
|
|||
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
|
||||
<li>David Vidal</li>
|
||||
<li>João Marques</li>
|
||||
<li>Alexandre Díaz</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -435,7 +436,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
|
|||
<p>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.</p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/web/tree/13.0/web_disable_export_group">OCA/web</a> project on GitHub.</p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/web/tree/14.0/web_disable_export_group">OCA/web</a> project on GitHub.</p>
|
||||
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -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") +
|
||||
'"))',
|
||||
},
|
||||
|
|
|
@ -5,8 +5,28 @@ import odoo.tests
|
|||
|
||||
@odoo.tests.tagged("post_install", "-at_install")
|
||||
class TestTour(odoo.tests.HttpCase):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.env["res.users"].create(
|
||||
{
|
||||
"name": "user_not_export",
|
||||
"login": "user_not_export",
|
||||
"password": "user_not_export",
|
||||
"groups_id": [
|
||||
(
|
||||
6,
|
||||
0,
|
||||
[
|
||||
self.env.ref("base.group_user").id,
|
||||
self.env.ref("base.group_system").id,
|
||||
],
|
||||
)
|
||||
],
|
||||
}
|
||||
)
|
||||
|
||||
def test_admin(self):
|
||||
self.start_tour("/web", "export_tour_admin", login="admin")
|
||||
|
||||
def test_demo(self):
|
||||
self.start_tour("/web", "export_tour_demo", login="demo")
|
||||
def test_user_not_export(self):
|
||||
self.start_tour("/web", "export_tour_demo", login="user_not_export")
|
||||
|
|
Loading…
Reference in New Issue