[IMP] base_view_inheritance_extension: pre-commit auto fixes

pull/2795/head
Alexis de Lattre 2023-12-29 16:51:06 +01:00
parent d863797667
commit d5b257a484
12 changed files with 94 additions and 96 deletions

View File

@ -17,19 +17,19 @@ Extended view inheritance
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3 :alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github
:target: https://github.com/OCA/server-tools/tree/16.0/base_view_inheritance_extension :target: https://github.com/OCA/server-tools/tree/17.0/base_view_inheritance_extension
:alt: OCA/server-tools :alt: OCA/server-tools
.. |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/server-tools-16-0/server-tools-16-0-base_view_inheritance_extension :target: https://translation.odoo-community.org/projects/server-tools-17-0/server-tools-17-0-base_view_inheritance_extension
:alt: Translate me on Weblate :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-tools&target_branch=16.0 :target: https://runboat.odoo-community.org/builds?repo=OCA/server-tools&target_branch=17.0
:alt: Try me on Runboat :alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5| |badge1| |badge2| |badge3| |badge4| |badge5|
This module was written to make it simple to add custom operators for view This module was written to make it simple to add custom operators for
inheritance. view inheritance.
**Table of contents** **Table of contents**
@ -41,8 +41,7 @@ Usage
**Change a python dictionary (context for example)** **Change a python dictionary (context for example)**
.. code:: xml
.. code-block:: xml
<field position="attributes"> <field position="attributes">
<attribute name="context" operation="update"> <attribute name="context" operation="update">
@ -52,21 +51,21 @@ Usage
</attribute> </attribute>
</field> </field>
Note that views are subject to evaluation of xmlids anyways, so if you
Note that views are subject to evaluation of xmlids anyways, so if you need need to refer to some xmlid, say ``%(xmlid)s``.
to refer to some xmlid, say ``%(xmlid)s``.
**Add text after and/or before than original** **Add text after and/or before than original**
.. code-block:: xml .. code:: xml
<attribute name="$attribute" operation="text_add"> <attribute name="$attribute" operation="text_add">
$text_before {old_value} $text_after $text_before {old_value} $text_after
</attribute> </attribute>
**Add domain with AND/OR join operator (AND if missed) allowing conditional changes** **Add domain with AND/OR join operator (AND if missed) allowing
conditional changes**
.. code-block:: xml .. code:: xml
<attribute name="$attribute" operation="domain_add" <attribute name="$attribute" operation="domain_add"
condition="$field_condition" join_operator="OR"> condition="$field_condition" join_operator="OR">
@ -76,7 +75,7 @@ to refer to some xmlid, say ``%(xmlid)s``.
Known issues / Roadmap Known issues / Roadmap
====================== ======================
* Support an ``eval`` attribute for our new node types. - Support an ``eval`` attribute for our new node types.
Bug Tracker Bug Tracker
=========== ===========
@ -84,7 +83,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-tools/issues>`_. Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-tools/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 to smash it by providing a detailed and welcomed If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/server-tools/issues/new?body=module:%20base_view_inheritance_extension%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. `feedback <https://github.com/OCA/server-tools/issues/new?body=module:%20base_view_inheritance_extension%0Aversion:%2017.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.
@ -92,24 +91,24 @@ Credits
======= =======
Authors Authors
~~~~~~~ -------
* Therp BV * Therp BV
Contributors Contributors
~~~~~~~~~~~~ ------------
* Holger Brunn <hbrunn@therp.nl> - Holger Brunn <hbrunn@therp.nl>
* Ronald Portier <rportier@therp.nl> - Ronald Portier <rportier@therp.nl>
* `Tecnativa <https://www.tecnativa.com>`_: - `Tecnativa <https://www.tecnativa.com>`__:
* Sergio Teruel - Sergio Teruel
* Carlos Dauden - Carlos Dauden
* Iván Todorovich <ivan.todorovich@camptocamp.com> - Iván Todorovich <ivan.todorovich@camptocamp.com>
Maintainers Maintainers
~~~~~~~~~~~ -----------
This module is maintained by the OCA. This module is maintained by the OCA.
@ -121,6 +120,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/server-tools <https://github.com/OCA/server-tools/tree/16.0/base_view_inheritance_extension>`_ project on GitHub. This module is part of the `OCA/server-tools <https://github.com/OCA/server-tools/tree/17.0/base_view_inheritance_extension>`_ 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

@ -181,11 +181,7 @@ class IrUiView(models.Model):
# in update mode the domain cause an invalid syntax error # in update mode the domain cause an invalid syntax error
new_value = attribute_node.text.strip() new_value = attribute_node.text.strip()
if condition: if condition:
new_value = "{condition} and {new_value} or {old_value}".format( new_value = f"{condition} and {new_value} or {old_value or []}"
condition=condition,
new_value=new_value,
old_value=old_value or [],
)
node.attrib[attribute_name] = new_value node.attrib[attribute_name] = new_value
return source return source

View File

@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"

View File

@ -0,0 +1,6 @@
- Holger Brunn \<<hbrunn@therp.nl>\>
- Ronald Portier \<<rportier@therp.nl>\>
- [Tecnativa](https://www.tecnativa.com):
- Sergio Teruel
- Carlos Dauden
- Iván Todorovich \<<ivan.todorovich@camptocamp.com>\>

View File

@ -1,8 +0,0 @@
* Holger Brunn <hbrunn@therp.nl>
* Ronald Portier <rportier@therp.nl>
* `Tecnativa <https://www.tecnativa.com>`_:
* Sergio Teruel
* Carlos Dauden
* Iván Todorovich <ivan.todorovich@camptocamp.com>

View File

@ -1,2 +1,2 @@
This module was written to make it simple to add custom operators for view This module was written to make it simple to add custom operators for
inheritance. view inheritance.

View File

@ -0,0 +1 @@
- Support an `eval` attribute for our new node types.

View File

@ -1 +0,0 @@
* Support an ``eval`` attribute for our new node types.

View File

@ -0,0 +1,32 @@
**Change a python dictionary (context for example)**
``` xml
<field position="attributes">
<attribute name="context" operation="update">
{
"key": "value",
}
</attribute>
</field>
```
Note that views are subject to evaluation of xmlids anyways, so if you
need to refer to some xmlid, say `%(xmlid)s`.
**Add text after and/or before than original**
``` xml
<attribute name="$attribute" operation="text_add">
$text_before {old_value} $text_after
</attribute>
```
**Add domain with AND/OR join operator (AND if missed) allowing
conditional changes**
``` xml
<attribute name="$attribute" operation="domain_add"
condition="$field_condition" join_operator="OR">
$domain_to_add
</attribute>
```

View File

@ -1,33 +0,0 @@
**Change a python dictionary (context for example)**
.. code-block:: xml
<field position="attributes">
<attribute name="context" operation="update">
{
"key": "value",
}
</attribute>
</field>
Note that views are subject to evaluation of xmlids anyways, so if you need
to refer to some xmlid, say ``%(xmlid)s``.
**Add text after and/or before than original**
.. code-block:: xml
<attribute name="$attribute" operation="text_add">
$text_before {old_value} $text_after
</attribute>
**Add domain with AND/OR join operator (AND if missed) allowing conditional changes**
.. code-block:: xml
<attribute name="$attribute" operation="domain_add"
condition="$field_condition" join_operator="OR">
$domain_to_add
</attribute>

View File

@ -369,9 +369,9 @@ ul.auto-toc {
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:56c707d911c93aace4dc1593e4c0f7de5816cdf8883d581a9cfdf7d500b2de66 !! source digest: sha256:56c707d911c93aace4dc1593e4c0f7de5816cdf8883d581a9cfdf7d500b2de66
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Mature" src="https://img.shields.io/badge/maturity-Mature-brightgreen.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/server-tools/tree/16.0/base_view_inheritance_extension"><img alt="OCA/server-tools" src="https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/server-tools-16-0/server-tools-16-0-base_view_inheritance_extension"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/server-tools&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p> <p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Mature" src="https://img.shields.io/badge/maturity-Mature-brightgreen.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/server-tools/tree/17.0/base_view_inheritance_extension"><img alt="OCA/server-tools" src="https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/server-tools-17-0/server-tools-17-0-base_view_inheritance_extension"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/server-tools&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module was written to make it simple to add custom operators for view <p>This module was written to make it simple to add custom operators for
inheritance.</p> view inheritance.</p>
<p><strong>Table of contents</strong></p> <p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents"> <div class="contents local topic" id="contents">
<ul class="simple"> <ul class="simple">
@ -398,15 +398,16 @@ inheritance.</p>
</span><span class="nt">&lt;/attribute&gt;</span><span class="w"> </span><span class="nt">&lt;/attribute&gt;</span><span class="w">
</span><span class="nt">&lt;/field&gt;</span> </span><span class="nt">&lt;/field&gt;</span>
</pre> </pre>
<p>Note that views are subject to evaluation of xmlids anyways, so if you need <p>Note that views are subject to evaluation of xmlids anyways, so if you
to refer to some xmlid, say <tt class="docutils literal">%(xmlid)s</tt>.</p> need to refer to some xmlid, say <tt class="docutils literal">%(xmlid)s</tt>.</p>
<p><strong>Add text after and/or before than original</strong></p> <p><strong>Add text after and/or before than original</strong></p>
<pre class="code xml literal-block"> <pre class="code xml literal-block">
<span class="nt">&lt;attribute</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;$attribute&quot;</span><span class="w"> </span><span class="na">operation=</span><span class="s">&quot;text_add&quot;</span><span class="nt">&gt;</span><span class="w"> <span class="nt">&lt;attribute</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;$attribute&quot;</span><span class="w"> </span><span class="na">operation=</span><span class="s">&quot;text_add&quot;</span><span class="nt">&gt;</span><span class="w">
</span>$text_before<span class="w"> </span>{old_value}<span class="w"> </span>$text_after<span class="w"> </span>$text_before<span class="w"> </span>{old_value}<span class="w"> </span>$text_after<span class="w">
</span><span class="nt">&lt;/attribute&gt;</span> </span><span class="nt">&lt;/attribute&gt;</span>
</pre> </pre>
<p><strong>Add domain with AND/OR join operator (AND if missed) allowing conditional changes</strong></p> <p><strong>Add domain with AND/OR join operator (AND if missed) allowing
conditional changes</strong></p>
<pre class="code xml literal-block"> <pre class="code xml literal-block">
<span class="nt">&lt;attribute</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;$attribute&quot;</span><span class="w"> </span><span class="na">operation=</span><span class="s">&quot;domain_add&quot;</span><span class="w"> <span class="nt">&lt;attribute</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;$attribute&quot;</span><span class="w"> </span><span class="na">operation=</span><span class="s">&quot;domain_add&quot;</span><span class="w">
</span><span class="na">condition=</span><span class="s">&quot;$field_condition&quot;</span><span class="w"> </span><span class="na">join_operator=</span><span class="s">&quot;OR&quot;</span><span class="nt">&gt;</span><span class="w"> </span><span class="na">condition=</span><span class="s">&quot;$field_condition&quot;</span><span class="w"> </span><span class="na">join_operator=</span><span class="s">&quot;OR&quot;</span><span class="nt">&gt;</span><span class="w">
@ -425,7 +426,7 @@ to refer to some xmlid, say <tt class="docutils literal">%(xmlid)s</tt>.</p>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/server-tools/issues">GitHub Issues</a>. <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/server-tools/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 to smash it by providing a detailed and welcomed If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/server-tools/issues/new?body=module:%20base_view_inheritance_extension%0Aversion:%2016.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/server-tools/issues/new?body=module:%20base_view_inheritance_extension%0Aversion:%2017.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">
@ -456,7 +457,7 @@ If you spotted it first, help us to smash 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/server-tools/tree/16.0/base_view_inheritance_extension">OCA/server-tools</a> project on GitHub.</p> <p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-tools/tree/17.0/base_view_inheritance_extension">OCA/server-tools</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>

2
requirements.txt 100644
View File

@ -0,0 +1,2 @@
# generated from manifests external_dependencies
astor