From f8dc8750d7ba5836db0aa0e78d0b267cdbf641af Mon Sep 17 00:00:00 2001 From: ernesto Date: Wed, 21 Nov 2018 22:50:59 -0500 Subject: [PATCH] [MIG] web_dialog_size: Migration to 12.0 --- web_dialog_size/README.rst | 24 +++++++--- web_dialog_size/__manifest__.py | 2 +- web_dialog_size/models/ir_config_parameter.py | 4 +- web_dialog_size/readme/CONFIGURE.rst | 5 +++ web_dialog_size/readme/CONTRIBUTORS.rst | 5 ++- web_dialog_size/static/description/index.html | 44 ++++++++++++------- .../static/src/css/web_dialog_size.css | 15 ------- .../static/src/scss/web_dialog_size.scss | 24 ++++++++++ .../static/src/xml/web_dialog_size.xml | 2 +- web_dialog_size/templates/assets.xml | 2 +- web_dialog_size/tests/__init__.py | 1 + web_dialog_size/tests/test_web_dialog_size.py | 20 +++++++++ 12 files changed, 104 insertions(+), 44 deletions(-) create mode 100644 web_dialog_size/readme/CONFIGURE.rst delete mode 100644 web_dialog_size/static/src/css/web_dialog_size.css create mode 100644 web_dialog_size/static/src/scss/web_dialog_size.scss create mode 100644 web_dialog_size/tests/__init__.py create mode 100644 web_dialog_size/tests/test_web_dialog_size.py diff --git a/web_dialog_size/README.rst b/web_dialog_size/README.rst index 440f06333..ee62e1816 100644 --- a/web_dialog_size/README.rst +++ b/web_dialog_size/README.rst @@ -14,13 +14,13 @@ Web Dialog Size :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/11.0/web_dialog_size + :target: https://github.com/OCA/web/tree/12.0/web_dialog_size :alt: OCA/web .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/web-11-0/web-11-0-web_dialog_size + :target: https://translation.odoo-community.org/projects/web-12-0/web-12-0-web_dialog_size :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/11.0 + :target: https://runbot.odoo-community.org/runbot/162/12.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -34,13 +34,22 @@ It also adds draggable support to the dialogs. .. contents:: :local: +Configuration +============= + +If you want to set dialog boxes maximized by default, you need to: + +#. Go to *Settings -> Technical -> Parameters -> System Parameters* +#. Add a new record with the text *web_dialog_size.default_maximize* in + the *Key* field and the text *True* in the *Value* field + 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 smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -68,8 +77,9 @@ Contributors * Quentin Theuret * `Tecnativa `_: - * Pedro M. Baeza - * Jairo Llopis + * Pedro M. Baeza + * Jairo Llopis + * Ernesto Tejeda Maintainers ~~~~~~~~~~~ @@ -84,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 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_dialog_size/__manifest__.py b/web_dialog_size/__manifest__.py index 4e799d1a5..31f85ac95 100644 --- a/web_dialog_size/__manifest__.py +++ b/web_dialog_size/__manifest__.py @@ -15,7 +15,7 @@ "Odoo Community Association (OCA)", 'website': "http://github.com/OCA/web", 'category': 'web', - 'version': '11.0.1.0.3', + 'version': '12.0.1.0.0', 'license': 'AGPL-3', 'depends': [ 'web', diff --git a/web_dialog_size/models/ir_config_parameter.py b/web_dialog_size/models/ir_config_parameter.py index bc916db00..4de06e322 100644 --- a/web_dialog_size/models/ir_config_parameter.py +++ b/web_dialog_size/models/ir_config_parameter.py @@ -12,6 +12,6 @@ class IrConfigParameter(Model): def get_web_dialog_size_config(self): get_param = self.sudo().get_param return { - key: const_eval(get_param("web_dialog_size.%s" % key, "False")) - for key in ["default_maximize"] + "default_maximize": const_eval( + get_param("web_dialog_size.default_maximize", "False")) } diff --git a/web_dialog_size/readme/CONFIGURE.rst b/web_dialog_size/readme/CONFIGURE.rst new file mode 100644 index 000000000..902f3316e --- /dev/null +++ b/web_dialog_size/readme/CONFIGURE.rst @@ -0,0 +1,5 @@ +If you want to set dialog boxes maximized by default, you need to: + +#. Go to *Settings -> Technical -> Parameters -> System Parameters* +#. Add a new record with the text *web_dialog_size.default_maximize* in + the *Key* field and the text *True* in the *Value* field diff --git a/web_dialog_size/readme/CONTRIBUTORS.rst b/web_dialog_size/readme/CONTRIBUTORS.rst index 0641b1d1e..e78168e41 100644 --- a/web_dialog_size/readme/CONTRIBUTORS.rst +++ b/web_dialog_size/readme/CONTRIBUTORS.rst @@ -7,5 +7,6 @@ * Quentin Theuret * `Tecnativa `_: - * Pedro M. Baeza - * Jairo Llopis + * Pedro M. Baeza + * Jairo Llopis + * Ernesto Tejeda diff --git a/web_dialog_size/static/description/index.html b/web_dialog_size/static/description/index.html index ce5afa560..64208125a 100644 --- a/web_dialog_size/static/description/index.html +++ b/web_dialog_size/static/description/index.html @@ -367,34 +367,47 @@ ul.auto-toc { !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

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

+

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

A module that lets the user expand/restore the dialog box size through a button in the upper right corner (imitating most windows managers). It also adds draggable support to the dialogs.

Table of contents

+
+

Configuration

+

If you want to set dialog boxes maximized by default, you need to:

+
    +
  1. Go to Settings -> Technical -> Parameters -> System Parameters
  2. +
  3. +
    Add a new record with the text web_dialog_size.default_maximize in
    +
    the Key field and the text True in the Value field
    +
    +
  4. +
+
-

Bug Tracker

+

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 smashing it by providing a detailed and welcomed -feedback.

+feedback.

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

-

Credits

+

Credits

-

Authors

+

Authors

  • ACSONE SA/NV
  • Therp BV
  • @@ -404,7 +417,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
-

Contributors

+

Contributors

-

Maintainers

+

Maintainers

This module is maintained by the OCA.

Odoo Community Association

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_dialog_size/static/src/css/web_dialog_size.css b/web_dialog_size/static/src/css/web_dialog_size.css deleted file mode 100644 index bd7fdb2ee..000000000 --- a/web_dialog_size/static/src/css/web_dialog_size.css +++ /dev/null @@ -1,15 +0,0 @@ -.modal .modal-header button.dialog_button_extend { - padding-right: 5px; -} - -.modal .modal-header button.dialog_button_restore { - padding-right: 5px; -} - -.dialog_full_screen { - width: calc(100% - 50px); -} - -.modal .modal-header button.close { - font-size: 18px; -} diff --git a/web_dialog_size/static/src/scss/web_dialog_size.scss b/web_dialog_size/static/src/scss/web_dialog_size.scss new file mode 100644 index 000000000..8e5e86b83 --- /dev/null +++ b/web_dialog_size/static/src/scss/web_dialog_size.scss @@ -0,0 +1,24 @@ + +.modal { + .dialog_full_screen { + @include media-breakpoint-up(sm) { + max-width: 100%; + width: calc(100% - 50px); + } + } + .modal-header button.close { + font-size: 18px; + + &:not(.dialog_button_extend):not(.dialog_button_restore) { + @include media-breakpoint-up(sm) { + margin-left: 15px; + } + } + + &.dialog_button_extend, .dialog_button_restore { + @include media-breakpoint-down(sm) { + display: none !important; + } + } + } +} diff --git a/web_dialog_size/static/src/xml/web_dialog_size.xml b/web_dialog_size/static/src/xml/web_dialog_size.xml index 51e6fd6ae..1ef058fe5 100644 --- a/web_dialog_size/static/src/xml/web_dialog_size.xml +++ b/web_dialog_size/static/src/xml/web_dialog_size.xml @@ -4,7 +4,7 @@ - + diff --git a/web_dialog_size/templates/assets.xml b/web_dialog_size/templates/assets.xml index 103b3d970..0845e5027 100644 --- a/web_dialog_size/templates/assets.xml +++ b/web_dialog_size/templates/assets.xml @@ -2,7 +2,7 @@ diff --git a/web_dialog_size/tests/__init__.py b/web_dialog_size/tests/__init__.py new file mode 100644 index 000000000..79d02635e --- /dev/null +++ b/web_dialog_size/tests/__init__.py @@ -0,0 +1 @@ +from . import test_web_dialog_size diff --git a/web_dialog_size/tests/test_web_dialog_size.py b/web_dialog_size/tests/test_web_dialog_size.py new file mode 100644 index 000000000..6d6014d0d --- /dev/null +++ b/web_dialog_size/tests/test_web_dialog_size.py @@ -0,0 +1,20 @@ +# Copyright 2018 Tecnativa - Ernesto Tejeda +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0 + +from odoo.tests.common import TransactionCase + + +class TestWebDialogSize(TransactionCase): + def setUp(self): + super(TestWebDialogSize, self).setUp() + + def test_get_web_dialog_size_config(self): + obj = self.env['ir.config_parameter'] + + self.assertFalse(obj.get_web_dialog_size_config()['default_maximize']) + + obj.set_param("web_dialog_size.default_maximize", "True") + self.assertTrue(obj.get_web_dialog_size_config()['default_maximize']) + + obj.set_param("web_dialog_size.default_maximize", "False") + self.assertFalse(obj.get_web_dialog_size_config()['default_maximize'])