[MIG] web_disable_export_group: Migration to 13.0

TT26186
pull/1714/head
João Marques 2020-10-21 09:11:29 +01:00
parent e6f34839eb
commit b210257b93
10 changed files with 116 additions and 51 deletions

View File

@ -14,13 +14,13 @@ Web Disable Export Group
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3 :alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github
:target: https://github.com/OCA/web/tree/12.0/web_disable_export_group :target: https://github.com/OCA/web/tree/13.0/web_disable_export_group
:alt: OCA/web :alt: OCA/web
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/web-12-0/web-12-0-web_disable_export_group :target: https://translation.odoo-community.org/projects/web-13-0/web-13-0-web_disable_export_group
:alt: Translate me on Weblate :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/162/12.0 :target: https://runbot.odoo-community.org/runbot/162/13.0
:alt: Try me on Runbot :alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5| |badge1| |badge2| |badge3| |badge4| |badge5|
@ -55,7 +55,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_. 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. 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 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:%2012.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:%2013.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. Do not contact contributors directly about support or help with technical issues.
@ -78,7 +78,8 @@ Contributors
* `Tecnativa <https://www.tecnativa.com>`_: * `Tecnativa <https://www.tecnativa.com>`_:
* David Vidal <david.vidal@tecnativa.com> * David Vidal
* João Marques
Maintainers Maintainers
~~~~~~~~~~~ ~~~~~~~~~~~
@ -93,6 +94,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use. promote its widespread use.
This module is part of the `OCA/web <https://github.com/OCA/web/tree/12.0/web_disable_export_group>`_ project on GitHub. This module is part of the `OCA/web <https://github.com/OCA/web/tree/13.0/web_disable_export_group>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@ -1,14 +1,19 @@
# Copyright 2016 Onestein (<http://www.onestein.eu>) # Copyright 2016 Onestein (<http://www.onestein.eu>)
# Copyright 2018 Tecnativa - David Vidal # Copyright 2018 Tecnativa - David Vidal
# Copyright 2018 Tecnativa - João Marques
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{ {
"name": "Web Disable Export Group", "name": "Web Disable Export Group",
"version": "12.0.1.0.0", "version": "13.0.1.0.0",
"license": "AGPL-3", "license": "AGPL-3",
"author": "Onestein, " "Tecnativa, " "Odoo Community Association (OCA)", "author": "Onestein, " "Tecnativa, " "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/web", "website": "https://github.com/OCA/web",
"category": "Web", "category": "Web",
"depends": ["web",], "depends": ["web"],
"data": ["security/groups.xml", "templates/assets.xml",], "data": [
"security/groups.xml",
"templates/assets.xml",
"templates/tour_assets.xml",
],
"installable": True, "installable": True,
} }

View File

@ -9,7 +9,7 @@ class Http(models.AbstractModel):
_inherit = "ir.http" _inherit = "ir.http"
def session_info(self): def session_info(self):
res = super(Http, self).session_info() res = super().session_info()
user = request.env.user user = request.env.user
res.update( res.update(
{ {

View File

@ -5,4 +5,5 @@
* `Tecnativa <https://www.tecnativa.com>`_: * `Tecnativa <https://www.tecnativa.com>`_:
* David Vidal <david.vidal@tecnativa.com> * David Vidal
* João Marques

View File

@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !! !! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !! !! 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/12.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-12-0/web-12-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/12.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/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>In the standard Odoo the UI option Export that is present in the Action menu <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> 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 <p>This module makes the option Export enabled only for the users that belong
@ -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>. <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. 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 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:%2012.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:%2013.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> <p>Do not contact contributors directly about support or help with technical issues.</p>
</div> </div>
<div class="section" id="credits"> <div class="section" id="credits">
@ -422,7 +422,8 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
</ul> </ul>
</li> </li>
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul> <li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
<li>David Vidal &lt;<a class="reference external" href="mailto:david.vidal&#64;tecnativa.com">david.vidal&#64;tecnativa.com</a>&gt;</li> <li>David Vidal</li>
<li>João Marques</li>
</ul> </ul>
</li> </li>
</ul> </ul>
@ -434,7 +435,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 <p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use.</p> promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/web/tree/12.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/13.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> <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>
</div> </div>

View File

@ -0,0 +1,63 @@
/* 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) {
"use strict";
var core = require("web.core");
var tour = require("web_tour.tour");
var _t = core._t;
tour.register(
"export_tour_admin",
{
test: true,
url:
"/web#model=ir.ui.view&view_type=list&cids=&action=base.action_ui_view",
},
[
{
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_control_panel div.o_dropdown_menu a:contains("' +
_t("Export") +
'")',
},
]
);
tour.register(
"export_tour_demo",
{
test: true,
url:
"/web#model=ir.ui.view&view_type=list&cids=&action=base.action_ui_view",
},
[
{
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_control_panel div.o_dropdown_menu a:first:not(:contains("' +
_t("Export") +
'"))',
},
]
);
return {};
});

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2020 Tecnativa - João Marques
License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).-->
<odoo>
<template
id="assets_tests"
inherit_id="web.assets_tests"
name="Web Disable Export Group Assets Tests"
>
<xpath expr="." position="inside">
<script
type="text/javascript"
src="/web_disable_export_group/static/src/js/web_disable_export_group_tour.js"
/>
</xpath>
</template>
</odoo>

View File

@ -1 +1 @@
from . import test_disable_export_group from . import test_tour

View File

@ -1,35 +0,0 @@
# Copyright 2018 Onestein
# Copyright 2019 Alexandre Díaz - <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.api import Environment
from odoo.tests.common import SavepointCase
from mock import patch
class TestDisableExportGroup(SavepointCase):
@patch("odoo.addons.base_setup.models.ir_http.request")
@patch("odoo.addons.web_disable_export_group.models.ir_http.request")
@patch("odoo.addons.web.models.ir_http.request")
@patch("odoo.addons.web_tour.models.ir_http.request")
def test_session_info(self, request, request1, request2, request3):
request.env = self.env
request1.env = self.env
request2.env = self.env
request3.env = self.env
session_info = self.env["ir.http"].session_info()
self.assertTrue(session_info["group_export_data"])
@patch("odoo.addons.base_setup.models.ir_http.request")
@patch("odoo.addons.web_disable_export_group.models.ir_http.request")
@patch("odoo.addons.web.models.ir_http.request")
@patch("odoo.addons.web_tour.models.ir_http.request")
def test_session_info_not_allowed(self, request, request1, request2, request3):
demo_env = Environment(self.env.cr, self.env.ref("base.default_user").id, {})
request.env = demo_env
request1.env = demo_env
request2.env = demo_env
request3.env = demo_env
session_info = demo_env["ir.http"].session_info()
self.assertFalse(session_info["group_export_data"])

View File

@ -0,0 +1,12 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
# Copyright 2020 Tecnativa - João Marques
import odoo.tests
@odoo.tests.tagged("post_install", "-at_install")
class TestTour(odoo.tests.HttpCase):
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")