From 4910a67c6cc80a96e17a4da96fd75d25a3bec8b0 Mon Sep 17 00:00:00 2001 From: Sergio Teruel Date: Fri, 26 Oct 2018 13:54:14 +0200 Subject: [PATCH] [MIG] base_view_inheritance_extension: Migration to 11.0 --- base_view_inheritance_extension/README.rst | 84 ++-- base_view_inheritance_extension/__init__.py | 2 - .../__manifest__.py | 6 +- .../models/__init__.py | 2 - .../models/ir_ui_view.py | 11 +- .../readme/CONTRIBUTORS.rst | 3 + .../readme/DESCRIPTION.rst | 2 + .../readme/ROADMAP.rst | 3 + .../readme/USAGE.rst | 36 ++ .../static/description/index.html | 461 ++++++++++++++++++ .../tests/__init__.py | 2 - .../test_base_view_inheritance_extension.py | 3 +- 12 files changed, 564 insertions(+), 51 deletions(-) create mode 100644 base_view_inheritance_extension/readme/CONTRIBUTORS.rst create mode 100644 base_view_inheritance_extension/readme/DESCRIPTION.rst create mode 100644 base_view_inheritance_extension/readme/ROADMAP.rst create mode 100644 base_view_inheritance_extension/readme/USAGE.rst create mode 100644 base_view_inheritance_extension/static/description/index.html diff --git a/base_view_inheritance_extension/README.rst b/base_view_inheritance_extension/README.rst index d97a5b97d..8844edc2e 100644 --- a/base_view_inheritance_extension/README.rst +++ b/base_view_inheritance_extension/README.rst @@ -1,23 +1,43 @@ -.. image:: https://img.shields.io/badge/licence-LGPL--3-blue.svg - :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html - :alt: License: LGPL-3 - ========================= Extended view inheritance ========================= +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png + :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github + :target: https://github.com/OCA/server-tools/tree/11.0/base_view_inheritance_extension + :alt: OCA/server-tools +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/server-tools-11-0/server-tools-11-0-base_view_inheritance_extension + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/149/11.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + This module was written to make it simple to add custom operators for view inheritance. +**Table of contents** + +.. contents:: + :local: + Usage ===== -.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas - :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/149/10.0 +**Change a python dictionary (context for example)** -Change a python dictionary (context for example) ------------------------------------------------- .. code-block:: xml @@ -28,8 +48,7 @@ Change a python dictionary (context for example) Note that views are subject to evaluation of xmlids anyways, so if you need to refer to some xmlid, say ``%(xmlid)s``. -Move an element in the view ---------------------------- +**Move an element in the view** .. code-block:: xml @@ -38,8 +57,7 @@ Move an element in the view This can also be used to wrap some element into another, create the target element first, then move the node youwant to wrap there. -Add to values in a list (states for example) --------------------------------------------- +**Add to values in a list (states for example)** .. code-block:: xml @@ -47,8 +65,7 @@ Add to values in a list (states for example) $new_value(s) -Remove values from a list (states for example) ----------------------------------------------- +**Remove values from a list (states for example)** .. code-block:: xml @@ -66,44 +83,41 @@ Known issues / Roadmap 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. +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 `_. + +Do not contact contributors directly about support or help with technical issues. Credits ======= -Images ------- +Authors +~~~~~~~ -* Odoo Community Association: - `Icon `_. +* Therp BV Contributors ------------- +~~~~~~~~~~~~ * Holger Brunn * Ronald Portier +* Sergio Teruel -Do not contact contributors directly about help with questions or problems -concerning this addon, but use the -`community mailing list `_ or the -`appropriate specialized mailinglist `_ -for help, and the bug tracker linked in `Bug Tracker`_ above for -technical issues. +Maintainers +~~~~~~~~~~~ -Maintainer ----------- +This module is maintained by the OCA. .. image:: https://odoo-community.org/logo.png :alt: Odoo Community Association :target: https://odoo-community.org -This module is maintained by the OCA. - 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. -To contribute to this module, please visit https://odoo-community.org. +This module is part of the `OCA/server-tools `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/base_view_inheritance_extension/__init__.py b/base_view_inheritance_extension/__init__.py index 4431c72c4..92325983c 100644 --- a/base_view_inheritance_extension/__init__.py +++ b/base_view_inheritance_extension/__init__.py @@ -1,4 +1,2 @@ -# -*- coding: utf-8 -*- -# © 2016 Therp BV # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). from . import models diff --git a/base_view_inheritance_extension/__manifest__.py b/base_view_inheritance_extension/__manifest__.py index 79b3cc94c..27a24017e 100644 --- a/base_view_inheritance_extension/__manifest__.py +++ b/base_view_inheritance_extension/__manifest__.py @@ -1,9 +1,9 @@ -# -*- coding: utf-8 -*- -# © 2016 Therp BV +# Copyright 2016 Therp BV +# Copyright 2018 Tecnativa - Sergio Teruel # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). { "name": "Extended view inheritance", - "version": "10.0.1.0.1", + "version": "11.0.1.0.0", "author": "Therp BV,Odoo Community Association (OCA)", "license": "LGPL-3", "category": "Hidden/Dependency", diff --git a/base_view_inheritance_extension/models/__init__.py b/base_view_inheritance_extension/models/__init__.py index 588d249e2..352589cd2 100644 --- a/base_view_inheritance_extension/models/__init__.py +++ b/base_view_inheritance_extension/models/__init__.py @@ -1,4 +1,2 @@ -# -*- coding: utf-8 -*- -# © 2016 Therp BV # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). from . import ir_ui_view diff --git a/base_view_inheritance_extension/models/ir_ui_view.py b/base_view_inheritance_extension/models/ir_ui_view.py index 7f3823371..c95631625 100644 --- a/base_view_inheritance_extension/models/ir_ui_view.py +++ b/base_view_inheritance_extension/models/ir_ui_view.py @@ -1,5 +1,5 @@ -# -*- coding: utf-8 -*- -# © 2016 Therp BV +# Copyright 2016 Therp BV +# Copyright 2018 Tecnativa - Sergio Teruel # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). from lxml import etree from odoo import api, models, tools @@ -20,14 +20,14 @@ class UnquoteObject(str): ','.join( [ UnquoteObject( - a if not isinstance(a, basestring) + a if not isinstance(a, str) else "'%s'" % a ) for a in args ] + [ '%s=%s' % (UnquoteObject(k), v) - for (k, v) in kwargs.iteritems() + for (k, v) in kwargs.items() ] ) ) @@ -162,5 +162,6 @@ class IrUiView(models.Model): old_values = (node.get(attribute_name) or '').split(',') remove_values = attribute_node.text.split(',') new_values = [x for x in old_values if x not in remove_values] - node.attrib[attribute_name] = ','.join(filter(None, new_values)) + node.attrib[attribute_name] = ','.join( + [_f for _f in new_values if _f]) return source diff --git a/base_view_inheritance_extension/readme/CONTRIBUTORS.rst b/base_view_inheritance_extension/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..41d2a472c --- /dev/null +++ b/base_view_inheritance_extension/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* Holger Brunn +* Ronald Portier +* Sergio Teruel diff --git a/base_view_inheritance_extension/readme/DESCRIPTION.rst b/base_view_inheritance_extension/readme/DESCRIPTION.rst new file mode 100644 index 000000000..0536b6f26 --- /dev/null +++ b/base_view_inheritance_extension/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +This module was written to make it simple to add custom operators for view +inheritance. diff --git a/base_view_inheritance_extension/readme/ROADMAP.rst b/base_view_inheritance_extension/readme/ROADMAP.rst new file mode 100644 index 000000000..ade040dce --- /dev/null +++ b/base_view_inheritance_extension/readme/ROADMAP.rst @@ -0,0 +1,3 @@ +* add ``$value`` +* support ```` +* support an ``eval`` attribute for our new node types diff --git a/base_view_inheritance_extension/readme/USAGE.rst b/base_view_inheritance_extension/readme/USAGE.rst new file mode 100644 index 000000000..65199fd1e --- /dev/null +++ b/base_view_inheritance_extension/readme/USAGE.rst @@ -0,0 +1,36 @@ +**Change a python dictionary (context for example)** + + +.. code-block:: xml + + + $new_value + + +Note that views are subject to evaluation of xmlids anyways, so if you need +to refer to some xmlid, say ``%(xmlid)s``. + +**Move an element in the view** + +.. code-block:: xml + + + +This can also be used to wrap some element into another, create the target +element first, then move the node youwant to wrap there. + +**Add to values in a list (states for example)** + +.. code-block:: xml + + + $new_value(s) + + +**Remove values from a list (states for example)** + +.. code-block:: xml + + + $remove_value(s) + diff --git a/base_view_inheritance_extension/static/description/index.html b/base_view_inheritance_extension/static/description/index.html new file mode 100644 index 000000000..3d2599b76 --- /dev/null +++ b/base_view_inheritance_extension/static/description/index.html @@ -0,0 +1,461 @@ + + + + + + +Extended view inheritance + + + +
+

Extended view inheritance

+ + +

Beta License: LGPL-3 OCA/server-tools Translate me on Weblate Try me on Runbot

+

This module was written to make it simple to add custom operators for view +inheritance.

+

Table of contents

+ +
+

Usage

+

Change a python dictionary (context for example)

+
+<attribute name="$attribute" operation="python_dict" key="$key">
+    $new_value
+</attribute>
+
+

Note that views are subject to evaluation of xmlids anyways, so if you need +to refer to some xmlid, say %(xmlid)s.

+

Move an element in the view

+
+<xpath expr="$xpath" position="move" target="$targetxpath" />
+
+

This can also be used to wrap some element into another, create the target +element first, then move the node youwant to wrap there.

+

Add to values in a list (states for example)

+
+<attribute name="$attribute" operation="list_add">
+    $new_value(s)
+</attribute>
+
+

Remove values from a list (states for example)

+
+<attribute name="$attribute" operation="list_remove">
+    $remove_value(s)
+</attribute>
+
+
+
+

Known issues / Roadmap

+
    +
  • add <attribute operation="json_dict" key="$key">$value</attribute>
  • +
  • support <xpath expr="$xpath" position="move" target="xpath" target_position="position" />
  • +
  • support an eval attribute for our new node types
  • +
+
+
+

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.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Therp BV
  • +
+
+
+

Contributors

+ +
+
+

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/server-tools project on GitHub.

+

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

+
+
+
+ + diff --git a/base_view_inheritance_extension/tests/__init__.py b/base_view_inheritance_extension/tests/__init__.py index f76aba46a..e19c813a8 100644 --- a/base_view_inheritance_extension/tests/__init__.py +++ b/base_view_inheritance_extension/tests/__init__.py @@ -1,4 +1,2 @@ -# -*- coding: utf-8 -*- -# © 2016 Therp BV # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). from . import test_base_view_inheritance_extension diff --git a/base_view_inheritance_extension/tests/test_base_view_inheritance_extension.py b/base_view_inheritance_extension/tests/test_base_view_inheritance_extension.py index caeb8a359..212a20b5e 100644 --- a/base_view_inheritance_extension/tests/test_base_view_inheritance_extension.py +++ b/base_view_inheritance_extension/tests/test_base_view_inheritance_extension.py @@ -1,5 +1,4 @@ -# -*- coding: utf-8 -*- -# © 2016 Therp BV +# Copyright 2016 Therp BV # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). from lxml import etree from odoo.tests.common import TransactionCase