odoo-addon-base-view-inheritance-extension 17.0.1.0.1__py3-none-any.whl → 18.0.1.0.0.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- odoo/addons/base_view_inheritance_extension/README.rst +18 -13
- odoo/addons/base_view_inheritance_extension/__manifest__.py +1 -1
- odoo/addons/base_view_inheritance_extension/i18n/base_view_inheritance_extension.pot +1 -1
- odoo/addons/base_view_inheritance_extension/models/ir_ui_view.py +15 -20
- odoo/addons/base_view_inheritance_extension/readme/CONTRIBUTORS.md +3 -0
- odoo/addons/base_view_inheritance_extension/static/description/index.html +16 -8
- odoo/addons/base_view_inheritance_extension/tests/test_base_view_inheritance_extension.py +27 -69
- {odoo_addon_base_view_inheritance_extension-17.0.1.0.1.dist-info → odoo_addon_base_view_inheritance_extension-18.0.1.0.0.2.dist-info}/METADATA +21 -16
- {odoo_addon_base_view_inheritance_extension-17.0.1.0.1.dist-info → odoo_addon_base_view_inheritance_extension-18.0.1.0.0.2.dist-info}/RECORD +11 -11
- {odoo_addon_base_view_inheritance_extension-17.0.1.0.1.dist-info → odoo_addon_base_view_inheritance_extension-18.0.1.0.0.2.dist-info}/WHEEL +1 -1
- {odoo_addon_base_view_inheritance_extension-17.0.1.0.1.dist-info → odoo_addon_base_view_inheritance_extension-18.0.1.0.0.2.dist-info}/top_level.txt +0 -0
|
@@ -7,7 +7,7 @@ Extended view inheritance
|
|
|
7
7
|
!! This file is generated by oca-gen-addon-readme !!
|
|
8
8
|
!! changes will be overwritten. !!
|
|
9
9
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
10
|
-
!! source digest: sha256:
|
|
10
|
+
!! source digest: sha256:7d139c75ecf0e269f19de0443b9a28f4e56833de6af60ecff96f40a589297f5c
|
|
11
11
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
12
12
|
|
|
13
13
|
.. |badge1| image:: https://img.shields.io/badge/maturity-Mature-brightgreen.png
|
|
@@ -17,13 +17,13 @@ Extended view inheritance
|
|
|
17
17
|
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
|
|
18
18
|
:alt: License: LGPL-3
|
|
19
19
|
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github
|
|
20
|
-
:target: https://github.com/OCA/server-tools/tree/
|
|
20
|
+
:target: https://github.com/OCA/server-tools/tree/18.0/base_view_inheritance_extension
|
|
21
21
|
:alt: OCA/server-tools
|
|
22
22
|
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
|
23
|
-
:target: https://translation.odoo-community.org/projects/server-tools-
|
|
23
|
+
:target: https://translation.odoo-community.org/projects/server-tools-18-0/server-tools-18-0-base_view_inheritance_extension
|
|
24
24
|
:alt: Translate me on Weblate
|
|
25
25
|
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
|
|
26
|
-
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-tools&target_branch=
|
|
26
|
+
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-tools&target_branch=18.0
|
|
27
27
|
:alt: Try me on Runboat
|
|
28
28
|
|
|
29
29
|
|badge1| |badge2| |badge3| |badge4| |badge5|
|
|
@@ -75,7 +75,7 @@ conditional changes**
|
|
|
75
75
|
Known issues / Roadmap
|
|
76
76
|
======================
|
|
77
77
|
|
|
78
|
-
-
|
|
78
|
+
- Support an ``eval`` attribute for our new node types.
|
|
79
79
|
|
|
80
80
|
Bug Tracker
|
|
81
81
|
===========
|
|
@@ -83,7 +83,7 @@ Bug Tracker
|
|
|
83
83
|
Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-tools/issues>`_.
|
|
84
84
|
In case of trouble, please check there if your issue has already been reported.
|
|
85
85
|
If you spotted it first, help us to smash it by providing a detailed and welcomed
|
|
86
|
-
`feedback <https://github.com/OCA/server-tools/issues/new?body=module:%20base_view_inheritance_extension%0Aversion:%
|
|
86
|
+
`feedback <https://github.com/OCA/server-tools/issues/new?body=module:%20base_view_inheritance_extension%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
|
87
87
|
|
|
88
88
|
Do not contact contributors directly about support or help with technical issues.
|
|
89
89
|
|
|
@@ -98,14 +98,19 @@ Authors
|
|
|
98
98
|
Contributors
|
|
99
99
|
------------
|
|
100
100
|
|
|
101
|
-
-
|
|
102
|
-
-
|
|
103
|
-
-
|
|
101
|
+
- Holger Brunn <hbrunn@therp.nl>
|
|
102
|
+
- Ronald Portier <rportier@therp.nl>
|
|
103
|
+
- `Tecnativa <https://www.tecnativa.com>`__:
|
|
104
104
|
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
- Sergio Teruel
|
|
106
|
+
- Carlos Dauden
|
|
107
107
|
|
|
108
|
-
-
|
|
108
|
+
- `Trobz <https://www.trobz.com>`__:
|
|
109
|
+
|
|
110
|
+
- Nhan Tran <nhant@trobz.com>
|
|
111
|
+
|
|
112
|
+
- Iván Todorovich <ivan.todorovich@camptocamp.com>
|
|
113
|
+
- Frederic Grall <fgr@apik.cloud>
|
|
109
114
|
|
|
110
115
|
Maintainers
|
|
111
116
|
-----------
|
|
@@ -120,6 +125,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
|
|
|
120
125
|
mission is to support the collaborative development of Odoo features and
|
|
121
126
|
promote its widespread use.
|
|
122
127
|
|
|
123
|
-
This module is part of the `OCA/server-tools <https://github.com/OCA/server-tools/tree/
|
|
128
|
+
This module is part of the `OCA/server-tools <https://github.com/OCA/server-tools/tree/18.0/base_view_inheritance_extension>`_ project on GitHub.
|
|
124
129
|
|
|
125
130
|
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
|
|
4
4
|
{
|
|
5
5
|
"name": "Extended view inheritance",
|
|
6
|
-
"version": "
|
|
6
|
+
"version": "18.0.1.0.0",
|
|
7
7
|
"development_status": "Mature",
|
|
8
8
|
"author": "Therp BV,Odoo Community Association (OCA)",
|
|
9
9
|
"license": "LGPL-3",
|
|
@@ -3,11 +3,9 @@
|
|
|
3
3
|
# Copyright 2021 Camptocamp SA (https://www.camptocamp.com).
|
|
4
4
|
# Copyright 2023 Tecnativa - Carlos Dauden
|
|
5
5
|
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
|
|
6
|
-
|
|
7
6
|
import ast
|
|
8
7
|
import re
|
|
9
8
|
|
|
10
|
-
import astor
|
|
11
9
|
from lxml import etree
|
|
12
10
|
|
|
13
11
|
from odoo import api, models
|
|
@@ -30,7 +28,7 @@ def ast_dict_update(source, update):
|
|
|
30
28
|
|
|
31
29
|
def ast_key_eq(k1, k2):
|
|
32
30
|
# python < 3.8 uses ast.Str; python >= 3.8 uses ast.Constant
|
|
33
|
-
if type(k1)
|
|
31
|
+
if type(k1) is not type(k2):
|
|
34
32
|
return False
|
|
35
33
|
elif isinstance(k1, ast.Str):
|
|
36
34
|
return k1.s == k2.s
|
|
@@ -84,21 +82,21 @@ class IrUiView(models.Model):
|
|
|
84
82
|
@api.model
|
|
85
83
|
def _get_inheritance_handler(self, node):
|
|
86
84
|
handler = super().apply_inheritance_specs
|
|
87
|
-
if hasattr(self, "inheritance_handler_
|
|
88
|
-
handler = getattr(self, "inheritance_handler_
|
|
85
|
+
if hasattr(self, f"inheritance_handler_{node.tag}"):
|
|
86
|
+
handler = getattr(self, f"inheritance_handler_{node.tag}")
|
|
89
87
|
return handler
|
|
90
88
|
|
|
91
89
|
@api.model
|
|
92
90
|
def _get_inheritance_handler_attributes(self, node):
|
|
93
91
|
handler = super().apply_inheritance_specs
|
|
94
|
-
if hasattr(self, "
|
|
92
|
+
if hasattr(self, f"_inheritance_handler_attributes_{node.get('operation')}"):
|
|
95
93
|
handler = getattr(
|
|
96
|
-
self, "
|
|
94
|
+
self, f"_inheritance_handler_attributes_{node.get('operation')}"
|
|
97
95
|
)
|
|
98
96
|
return handler
|
|
99
97
|
|
|
100
98
|
@api.model
|
|
101
|
-
def
|
|
99
|
+
def _inheritance_handler_attributes_update(self, source, specs):
|
|
102
100
|
"""Implement dict `update` operation on the attribute node.
|
|
103
101
|
|
|
104
102
|
.. code-block:: xml
|
|
@@ -125,15 +123,11 @@ class IrUiView(models.Model):
|
|
|
125
123
|
# Update node ast dict
|
|
126
124
|
source_ast = ast_dict_update(source_ast, update_ast)
|
|
127
125
|
# Dump the ast back to source
|
|
128
|
-
|
|
129
|
-
node.attrib[attr_name] = astor.to_source(
|
|
130
|
-
source_ast,
|
|
131
|
-
pretty_source=lambda s: "".join(s).strip(),
|
|
132
|
-
)
|
|
126
|
+
node.attrib[attr_name] = ast.unparse(source_ast).strip()
|
|
133
127
|
return source
|
|
134
128
|
|
|
135
129
|
@api.model
|
|
136
|
-
def
|
|
130
|
+
def _inheritance_handler_attributes_text_add(self, source, specs):
|
|
137
131
|
"""Implement
|
|
138
132
|
<$node position="attributes">
|
|
139
133
|
<attribute name="$attribute" operation="text_add">
|
|
@@ -150,7 +144,7 @@ class IrUiView(models.Model):
|
|
|
150
144
|
return source
|
|
151
145
|
|
|
152
146
|
@api.model
|
|
153
|
-
def
|
|
147
|
+
def _inheritance_handler_attributes_domain_add(self, source, specs):
|
|
154
148
|
"""Implement
|
|
155
149
|
<$node position="attributes">
|
|
156
150
|
<attribute name="$attribute" operation="domain_add"
|
|
@@ -166,16 +160,17 @@ class IrUiView(models.Model):
|
|
|
166
160
|
old_value = node.get(attribute_name) or ""
|
|
167
161
|
if old_value:
|
|
168
162
|
old_domain = ast.literal_eval(
|
|
169
|
-
self.
|
|
163
|
+
self._var2str_domain_text(old_value.strip())
|
|
170
164
|
)
|
|
171
165
|
new_domain = ast.literal_eval(
|
|
172
|
-
self.
|
|
166
|
+
self._var2str_domain_text(attribute_node.text.strip())
|
|
173
167
|
)
|
|
174
168
|
if join_operator == "OR":
|
|
175
169
|
new_value = str(expression.OR([old_domain, new_domain]))
|
|
176
170
|
else:
|
|
177
171
|
new_value = str(expression.AND([old_domain, new_domain]))
|
|
178
|
-
new_value = self.
|
|
172
|
+
new_value = self._str2var_domain_text(new_value)
|
|
173
|
+
old_value = "".join(old_value.splitlines())
|
|
179
174
|
else:
|
|
180
175
|
# We must ensure that the domain definition has not line breaks because
|
|
181
176
|
# in update mode the domain cause an invalid syntax error
|
|
@@ -186,7 +181,7 @@ class IrUiView(models.Model):
|
|
|
186
181
|
return source
|
|
187
182
|
|
|
188
183
|
@api.model
|
|
189
|
-
def
|
|
184
|
+
def _var2str_domain_text(self, domain_str):
|
|
190
185
|
"""Replaces var names with str names to allow eval without defined vars"""
|
|
191
186
|
# Replace fields in 2 steps because 1 step returns "parent_sufix"."var_sufix"
|
|
192
187
|
regex_parent = re.compile(r"parent\.(\b\w+\b)")
|
|
@@ -197,7 +192,7 @@ class IrUiView(models.Model):
|
|
|
197
192
|
return re.sub(regex, r"'\1_is_a_var_to_replace'", domain_str)
|
|
198
193
|
|
|
199
194
|
@api.model
|
|
200
|
-
def
|
|
195
|
+
def _str2var_domain_text(self, domain_str):
|
|
201
196
|
"""Revert var2str_domain_text cleaning apostrophes and suffix in vars"""
|
|
202
197
|
pattern = re.compile(r"'(parent\.[^']+)_is_a_var_to_replace'")
|
|
203
198
|
domain_str = pattern.sub(r"\1", domain_str)
|
|
@@ -8,10 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
/*
|
|
10
10
|
:Author: David Goodger (goodger@python.org)
|
|
11
|
-
:Id: $Id: html4css1.css
|
|
11
|
+
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
|
|
12
12
|
:Copyright: This stylesheet has been placed in the public domain.
|
|
13
13
|
|
|
14
14
|
Default cascading style sheet for the HTML output of Docutils.
|
|
15
|
+
Despite the name, some widely supported CSS2 features are used.
|
|
15
16
|
|
|
16
17
|
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
|
|
17
18
|
customize this style sheet.
|
|
@@ -274,7 +275,7 @@ pre.literal-block, pre.doctest-block, pre.math, pre.code {
|
|
|
274
275
|
margin-left: 2em ;
|
|
275
276
|
margin-right: 2em }
|
|
276
277
|
|
|
277
|
-
pre.code .ln { color:
|
|
278
|
+
pre.code .ln { color: gray; } /* line numbers */
|
|
278
279
|
pre.code, code { background-color: #eeeeee }
|
|
279
280
|
pre.code .comment, code .comment { color: #5C6576 }
|
|
280
281
|
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
|
|
@@ -300,7 +301,7 @@ span.option {
|
|
|
300
301
|
span.pre {
|
|
301
302
|
white-space: pre }
|
|
302
303
|
|
|
303
|
-
span.problematic {
|
|
304
|
+
span.problematic, pre.problematic {
|
|
304
305
|
color: red }
|
|
305
306
|
|
|
306
307
|
span.section-subtitle {
|
|
@@ -366,9 +367,9 @@ ul.auto-toc {
|
|
|
366
367
|
!! This file is generated by oca-gen-addon-readme !!
|
|
367
368
|
!! changes will be overwritten. !!
|
|
368
369
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
369
|
-
!! source digest: sha256:
|
|
370
|
+
!! source digest: sha256:7d139c75ecf0e269f19de0443b9a28f4e56833de6af60ecff96f40a589297f5c
|
|
370
371
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
|
371
|
-
<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/
|
|
372
|
+
<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/18.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-18-0/server-tools-18-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&target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
|
372
373
|
<p>This module was written to make it simple to add custom operators for
|
|
373
374
|
view inheritance.</p>
|
|
374
375
|
<p><strong>Table of contents</strong></p>
|
|
@@ -425,7 +426,7 @@ conditional changes</strong></p>
|
|
|
425
426
|
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/server-tools/issues">GitHub Issues</a>.
|
|
426
427
|
In case of trouble, please check there if your issue has already been reported.
|
|
427
428
|
If you spotted it first, help us to smash it by providing a detailed and welcomed
|
|
428
|
-
<a class="reference external" href="https://github.com/OCA/server-tools/issues/new?body=module:%20base_view_inheritance_extension%0Aversion:%
|
|
429
|
+
<a class="reference external" href="https://github.com/OCA/server-tools/issues/new?body=module:%20base_view_inheritance_extension%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
|
429
430
|
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
|
430
431
|
</div>
|
|
431
432
|
<div class="section" id="credits">
|
|
@@ -446,17 +447,24 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
|
|
|
446
447
|
<li>Carlos Dauden</li>
|
|
447
448
|
</ul>
|
|
448
449
|
</li>
|
|
450
|
+
<li><a class="reference external" href="https://www.trobz.com">Trobz</a>:<ul>
|
|
451
|
+
<li>Nhan Tran <<a class="reference external" href="mailto:nhant@trobz.com">nhant@trobz.com</a>></li>
|
|
452
|
+
</ul>
|
|
453
|
+
</li>
|
|
449
454
|
<li>Iván Todorovich <<a class="reference external" href="mailto:ivan.todorovich@camptocamp.com">ivan.todorovich@camptocamp.com</a>></li>
|
|
455
|
+
<li>Frederic Grall <<a class="reference external" href="mailto:fgr@apik.cloud">fgr@apik.cloud</a>></li>
|
|
450
456
|
</ul>
|
|
451
457
|
</div>
|
|
452
458
|
<div class="section" id="maintainers">
|
|
453
459
|
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
|
|
454
460
|
<p>This module is maintained by the OCA.</p>
|
|
455
|
-
<a class="reference external image-reference" href="https://odoo-community.org"
|
|
461
|
+
<a class="reference external image-reference" href="https://odoo-community.org">
|
|
462
|
+
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
|
|
463
|
+
</a>
|
|
456
464
|
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
|
|
457
465
|
mission is to support the collaborative development of Odoo features and
|
|
458
466
|
promote its widespread use.</p>
|
|
459
|
-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-tools/tree/
|
|
467
|
+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-tools/tree/18.0/base_view_inheritance_extension">OCA/server-tools</a> project on GitHub.</p>
|
|
460
468
|
<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>
|
|
461
469
|
</div>
|
|
462
470
|
</div>
|
|
@@ -16,7 +16,7 @@ class TestBaseViewInheritanceExtension(TransactionCase):
|
|
|
16
16
|
|
|
17
17
|
def test_base_view_inheritance_extension(self):
|
|
18
18
|
view_id = self.env.ref("base.view_partner_simple_form").id
|
|
19
|
-
arch,
|
|
19
|
+
arch, _ = self.env["res.partner"]._get_view(view_id=view_id)
|
|
20
20
|
# Verify normal attributes work
|
|
21
21
|
self.assertEqual(arch.xpath("//form")[0].get("string"), "Partner form")
|
|
22
22
|
# Verify our extra context key worked
|
|
@@ -104,120 +104,78 @@ class TestBaseViewInheritanceExtension(TransactionCase):
|
|
|
104
104
|
]
|
|
105
105
|
self.assertEqual(
|
|
106
106
|
res.xpath('//field[@name="invoice_line_ids"]')[0].attrib["context"],
|
|
107
|
-
"{%s}" % ", ".join(expected_items),
|
|
107
|
+
"{%s}" % ", ".join(expected_items), # noqa: UP031
|
|
108
108
|
)
|
|
109
109
|
|
|
110
|
-
def
|
|
111
|
-
"""Test that we can add new keys to an existing dict"""
|
|
110
|
+
def test_text_add_operation(self):
|
|
112
111
|
source = etree.fromstring(
|
|
113
112
|
"""
|
|
114
113
|
<form>
|
|
115
|
-
<field
|
|
116
|
-
name="ref"
|
|
117
|
-
attrs="{'invisible': [('state', '=', 'draft')]}"
|
|
118
|
-
/>
|
|
114
|
+
<field name="customer_id" string="Client"/>
|
|
119
115
|
</form>
|
|
120
116
|
"""
|
|
121
117
|
)
|
|
118
|
+
|
|
122
119
|
specs = etree.fromstring(
|
|
123
120
|
"""
|
|
124
|
-
<field name="
|
|
125
|
-
<attribute name="
|
|
126
|
-
|
|
127
|
-
"required": [("state", "!=", "draft")],
|
|
128
|
-
}
|
|
129
|
-
</attribute>
|
|
121
|
+
<field name="customer_id" position="attributes">
|
|
122
|
+
<attribute name="string"
|
|
123
|
+
operation="text_add">{old_value} Customer</attribute>
|
|
130
124
|
</field>
|
|
131
125
|
"""
|
|
132
126
|
)
|
|
127
|
+
|
|
133
128
|
res = self.env["ir.ui.view"].apply_inheritance_specs(source, specs)
|
|
134
129
|
self.assertEqual(
|
|
135
|
-
res.xpath('//field[@name="
|
|
136
|
-
"
|
|
137
|
-
"'required': [('state', '!=', 'draft')]}",
|
|
130
|
+
res.xpath('//field[@name="customer_id"]')[0].attrib["string"],
|
|
131
|
+
"Client Customer",
|
|
138
132
|
)
|
|
139
133
|
|
|
140
|
-
def
|
|
141
|
-
"""
|
|
134
|
+
def test_update_operation_not_a_dict(self):
|
|
135
|
+
"""We should get an error if we try to update a dict with a non-dict spec"""
|
|
142
136
|
source = etree.fromstring(
|
|
143
137
|
"""
|
|
144
138
|
<form>
|
|
145
|
-
<field
|
|
146
|
-
name="ref"
|
|
147
|
-
attrs="{
|
|
148
|
-
'invisible': [('state', '=', 'draft')],
|
|
149
|
-
'required': [('state', '=', False)],
|
|
150
|
-
}"
|
|
151
|
-
/>
|
|
139
|
+
<field name="ref" />
|
|
152
140
|
</form>
|
|
153
141
|
"""
|
|
154
142
|
)
|
|
155
143
|
specs = etree.fromstring(
|
|
156
144
|
"""
|
|
157
145
|
<field name="ref" position="attributes">
|
|
158
|
-
<attribute name="
|
|
159
|
-
|
|
160
|
-
"required": [('state', '!=', 'draft')],
|
|
161
|
-
}
|
|
146
|
+
<attribute name="context" operation="update">
|
|
147
|
+
["not", "a", "dict"]
|
|
162
148
|
</attribute>
|
|
163
149
|
</field>
|
|
164
150
|
"""
|
|
165
151
|
)
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
"
|
|
170
|
-
"'required': [('state', '!=', 'draft')]}",
|
|
171
|
-
)
|
|
152
|
+
with self.assertRaisesRegex(
|
|
153
|
+
TypeError, "Operation for attribute `context` is not a dict"
|
|
154
|
+
):
|
|
155
|
+
self.env["ir.ui.view"].apply_inheritance_specs(source, specs)
|
|
172
156
|
|
|
173
|
-
def
|
|
174
|
-
"""Test that we can add new keys by creating the dict if it's missing"""
|
|
157
|
+
def test_domain_add_operation(self):
|
|
175
158
|
source = etree.fromstring(
|
|
176
159
|
"""
|
|
177
160
|
<form>
|
|
178
|
-
<field name="
|
|
161
|
+
<field name="child_ids" domain="[('state', '=', 'confirm')]" />
|
|
179
162
|
</form>
|
|
180
163
|
"""
|
|
181
164
|
)
|
|
182
165
|
specs = etree.fromstring(
|
|
183
166
|
"""
|
|
184
|
-
<field name="
|
|
185
|
-
<attribute name="
|
|
186
|
-
|
|
187
|
-
"required": [('state', '!=', 'draft')],
|
|
188
|
-
}
|
|
167
|
+
<field name="child_ids" position="attributes">
|
|
168
|
+
<attribute name="domain" operation="domain_add">
|
|
169
|
+
[('state', '!=', 'draft')]
|
|
189
170
|
</attribute>
|
|
190
171
|
</field>
|
|
191
172
|
"""
|
|
192
173
|
)
|
|
193
174
|
res = self.env["ir.ui.view"].apply_inheritance_specs(source, specs)
|
|
194
175
|
self.assertEqual(
|
|
195
|
-
res.xpath('//field[@name="
|
|
196
|
-
"
|
|
197
|
-
)
|
|
198
|
-
|
|
199
|
-
def test_update_operation_not_a_dict(self):
|
|
200
|
-
"""We should get an error if we try to update a dict with a non-dict spec"""
|
|
201
|
-
source = etree.fromstring(
|
|
202
|
-
"""
|
|
203
|
-
<form>
|
|
204
|
-
<field name="ref" />
|
|
205
|
-
</form>
|
|
206
|
-
"""
|
|
176
|
+
res.xpath('//field[@name="child_ids"]')[0].attrib["domain"],
|
|
177
|
+
"['&', ('state', '=', 'confirm'), ('state', '!=', 'draft')]",
|
|
207
178
|
)
|
|
208
|
-
specs = etree.fromstring(
|
|
209
|
-
"""
|
|
210
|
-
<field name="ref" position="attributes">
|
|
211
|
-
<attribute name="attrs" operation="update">
|
|
212
|
-
["not", "a", "dict"]
|
|
213
|
-
</attribute>
|
|
214
|
-
</field>
|
|
215
|
-
"""
|
|
216
|
-
)
|
|
217
|
-
with self.assertRaisesRegex(
|
|
218
|
-
TypeError, "Operation for attribute `attrs` is not a dict"
|
|
219
|
-
):
|
|
220
|
-
self.env["ir.ui.view"].apply_inheritance_specs(source, specs)
|
|
221
179
|
|
|
222
180
|
def test_update_source_not_a_dict(self):
|
|
223
181
|
"""We should get an error if we try to update a non-dict attribute"""
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: odoo-addon-base_view_inheritance_extension
|
|
3
|
-
Version:
|
|
3
|
+
Version: 18.0.1.0.0.2
|
|
4
4
|
Requires-Python: >=3.10
|
|
5
5
|
Requires-Dist: astor
|
|
6
|
-
Requires-Dist: odoo
|
|
6
|
+
Requires-Dist: odoo==18.0.*
|
|
7
7
|
Summary: Adds more operators for view inheritance
|
|
8
8
|
Home-page: https://github.com/OCA/server-tools
|
|
9
9
|
License: LGPL-3
|
|
@@ -11,7 +11,7 @@ Author: Therp BV,Odoo Community Association (OCA)
|
|
|
11
11
|
Author-email: support@odoo-community.org
|
|
12
12
|
Classifier: Programming Language :: Python
|
|
13
13
|
Classifier: Framework :: Odoo
|
|
14
|
-
Classifier: Framework :: Odoo ::
|
|
14
|
+
Classifier: Framework :: Odoo :: 18.0
|
|
15
15
|
Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)
|
|
16
16
|
Classifier: Development Status :: 6 - Mature
|
|
17
17
|
|
|
@@ -24,7 +24,7 @@ Extended view inheritance
|
|
|
24
24
|
!! This file is generated by oca-gen-addon-readme !!
|
|
25
25
|
!! changes will be overwritten. !!
|
|
26
26
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
27
|
-
!! source digest: sha256:
|
|
27
|
+
!! source digest: sha256:7d139c75ecf0e269f19de0443b9a28f4e56833de6af60ecff96f40a589297f5c
|
|
28
28
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
29
29
|
|
|
30
30
|
.. |badge1| image:: https://img.shields.io/badge/maturity-Mature-brightgreen.png
|
|
@@ -34,13 +34,13 @@ Extended view inheritance
|
|
|
34
34
|
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
|
|
35
35
|
:alt: License: LGPL-3
|
|
36
36
|
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github
|
|
37
|
-
:target: https://github.com/OCA/server-tools/tree/
|
|
37
|
+
:target: https://github.com/OCA/server-tools/tree/18.0/base_view_inheritance_extension
|
|
38
38
|
:alt: OCA/server-tools
|
|
39
39
|
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
|
40
|
-
:target: https://translation.odoo-community.org/projects/server-tools-
|
|
40
|
+
:target: https://translation.odoo-community.org/projects/server-tools-18-0/server-tools-18-0-base_view_inheritance_extension
|
|
41
41
|
:alt: Translate me on Weblate
|
|
42
42
|
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
|
|
43
|
-
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-tools&target_branch=
|
|
43
|
+
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-tools&target_branch=18.0
|
|
44
44
|
:alt: Try me on Runboat
|
|
45
45
|
|
|
46
46
|
|badge1| |badge2| |badge3| |badge4| |badge5|
|
|
@@ -92,7 +92,7 @@ conditional changes**
|
|
|
92
92
|
Known issues / Roadmap
|
|
93
93
|
======================
|
|
94
94
|
|
|
95
|
-
-
|
|
95
|
+
- Support an ``eval`` attribute for our new node types.
|
|
96
96
|
|
|
97
97
|
Bug Tracker
|
|
98
98
|
===========
|
|
@@ -100,7 +100,7 @@ Bug Tracker
|
|
|
100
100
|
Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-tools/issues>`_.
|
|
101
101
|
In case of trouble, please check there if your issue has already been reported.
|
|
102
102
|
If you spotted it first, help us to smash it by providing a detailed and welcomed
|
|
103
|
-
`feedback <https://github.com/OCA/server-tools/issues/new?body=module:%20base_view_inheritance_extension%0Aversion:%
|
|
103
|
+
`feedback <https://github.com/OCA/server-tools/issues/new?body=module:%20base_view_inheritance_extension%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
|
104
104
|
|
|
105
105
|
Do not contact contributors directly about support or help with technical issues.
|
|
106
106
|
|
|
@@ -115,14 +115,19 @@ Authors
|
|
|
115
115
|
Contributors
|
|
116
116
|
------------
|
|
117
117
|
|
|
118
|
-
-
|
|
119
|
-
-
|
|
120
|
-
-
|
|
118
|
+
- Holger Brunn <hbrunn@therp.nl>
|
|
119
|
+
- Ronald Portier <rportier@therp.nl>
|
|
120
|
+
- `Tecnativa <https://www.tecnativa.com>`__:
|
|
121
121
|
|
|
122
|
-
|
|
123
|
-
|
|
122
|
+
- Sergio Teruel
|
|
123
|
+
- Carlos Dauden
|
|
124
124
|
|
|
125
|
-
-
|
|
125
|
+
- `Trobz <https://www.trobz.com>`__:
|
|
126
|
+
|
|
127
|
+
- Nhan Tran <nhant@trobz.com>
|
|
128
|
+
|
|
129
|
+
- Iván Todorovich <ivan.todorovich@camptocamp.com>
|
|
130
|
+
- Frederic Grall <fgr@apik.cloud>
|
|
126
131
|
|
|
127
132
|
Maintainers
|
|
128
133
|
-----------
|
|
@@ -137,6 +142,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
|
|
|
137
142
|
mission is to support the collaborative development of Odoo features and
|
|
138
143
|
promote its widespread use.
|
|
139
144
|
|
|
140
|
-
This module is part of the `OCA/server-tools <https://github.com/OCA/server-tools/tree/
|
|
145
|
+
This module is part of the `OCA/server-tools <https://github.com/OCA/server-tools/tree/18.0/base_view_inheritance_extension>`_ project on GitHub.
|
|
141
146
|
|
|
142
147
|
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
odoo/addons/base_view_inheritance_extension/README.rst,sha256=
|
|
1
|
+
odoo/addons/base_view_inheritance_extension/README.rst,sha256=X2Fnbaf8KLCeInFLm5WHp-S-G0O2B7INHqYxcfN5SbA,4131
|
|
2
2
|
odoo/addons/base_view_inheritance_extension/__init__.py,sha256=X9EJGOE2GtZbS0G82PtSXmWSZ_R8jEM0rlJTDliQjp4,21
|
|
3
|
-
odoo/addons/base_view_inheritance_extension/__manifest__.py,sha256=
|
|
3
|
+
odoo/addons/base_view_inheritance_extension/__manifest__.py,sha256=2kT7coafGnnR0wsB5tb-nMnb7wMku13V3at4v4_qXQ8,616
|
|
4
4
|
odoo/addons/base_view_inheritance_extension/demo/ir_ui_view.xml,sha256=MHPVOGOM6XnNOTsq0ylz1B5r0sPJpRKHLan3K2mZ6sA,1200
|
|
5
|
-
odoo/addons/base_view_inheritance_extension/i18n/base_view_inheritance_extension.pot,sha256=
|
|
5
|
+
odoo/addons/base_view_inheritance_extension/i18n/base_view_inheritance_extension.pot,sha256=40BeQ2H1XXvtcdjxUnWllckEHGQ7Bwn7NyY1LhkvjAI,850
|
|
6
6
|
odoo/addons/base_view_inheritance_extension/i18n/ca.po,sha256=xFKkpPiT_RVTTR0H7ZzB2PW6M7aDhRzYhdiCoiRq6mY,1262
|
|
7
7
|
odoo/addons/base_view_inheritance_extension/i18n/de.po,sha256=MqXxL9L4jJ31fu7jIIqteOvyyznVG-NMTyOsalYrXdk,1183
|
|
8
8
|
odoo/addons/base_view_inheritance_extension/i18n/es.po,sha256=HtkLoCT-62M6WbiuAEdE_OCTd8L9wzmiDGcufzH8hsM,1315
|
|
@@ -12,16 +12,16 @@ odoo/addons/base_view_inheritance_extension/i18n/it.po,sha256=UWxqdWqJePuJaQNGgQ
|
|
|
12
12
|
odoo/addons/base_view_inheritance_extension/i18n/sl.po,sha256=EY6zKcR8nRRsfpjrKK2_CVqFXnUVPjSBOAkI4-voRYw,1265
|
|
13
13
|
odoo/addons/base_view_inheritance_extension/i18n/tr.po,sha256=xaYd2V2mHhQIeLqUpsE4VL3mHbT0DQVNbT9_jCXLc0I,1272
|
|
14
14
|
odoo/addons/base_view_inheritance_extension/models/__init__.py,sha256=SjKfc8ocbCImvP5DpGQbS0hWmQRYPjtzJdyio6TPII0,25
|
|
15
|
-
odoo/addons/base_view_inheritance_extension/models/ir_ui_view.py,sha256=
|
|
16
|
-
odoo/addons/base_view_inheritance_extension/readme/CONTRIBUTORS.md,sha256=
|
|
15
|
+
odoo/addons/base_view_inheritance_extension/models/ir_ui_view.py,sha256=3WXq_1WKxxQhEwpKOsIlalkICNEKopXV6Y4RZKm2PHQ,7928
|
|
16
|
+
odoo/addons/base_view_inheritance_extension/readme/CONTRIBUTORS.md,sha256=p9NQX_0BmuvidOJpkxO_NiDS6L19JI3lfxeHfuyG7Fs,319
|
|
17
17
|
odoo/addons/base_view_inheritance_extension/readme/DESCRIPTION.md,sha256=TC-vXmaSQ5oo7nNl5jxSyurQiz2597hDzQirRGw73BI,88
|
|
18
18
|
odoo/addons/base_view_inheritance_extension/readme/ROADMAP.md,sha256=79XqQ49EvpKp11-P-rimu8Mwklpwor3rkWKFPym9YbA,54
|
|
19
19
|
odoo/addons/base_view_inheritance_extension/readme/USAGE.md,sha256=g7ZkBJmm4ldDD-tkQjlzW7WpvssmBi23Dj2KCUuxlug,748
|
|
20
20
|
odoo/addons/base_view_inheritance_extension/static/description/icon.png,sha256=6xBPJauaFOF0KDHfHgQopSc28kKvxMaeoQFQWZtfZDo,9455
|
|
21
|
-
odoo/addons/base_view_inheritance_extension/static/description/index.html,sha256=
|
|
21
|
+
odoo/addons/base_view_inheritance_extension/static/description/index.html,sha256=GjjChKJTuqy3YAKBhyDn86fC-LD-h69UpnND9no8Pjg,15842
|
|
22
22
|
odoo/addons/base_view_inheritance_extension/tests/__init__.py,sha256=kTcGsgnWhpM7vII3sEdNX5XVxDHHqRc5KdrxInG6GSw,51
|
|
23
|
-
odoo/addons/base_view_inheritance_extension/tests/test_base_view_inheritance_extension.py,sha256=
|
|
24
|
-
odoo_addon_base_view_inheritance_extension-
|
|
25
|
-
odoo_addon_base_view_inheritance_extension-
|
|
26
|
-
odoo_addon_base_view_inheritance_extension-
|
|
27
|
-
odoo_addon_base_view_inheritance_extension-
|
|
23
|
+
odoo/addons/base_view_inheritance_extension/tests/test_base_view_inheritance_extension.py,sha256=7EDc_2z-Cr3v8MFYGj2crWL7kVWc7cvGI2FgY5HVBvY,7185
|
|
24
|
+
odoo_addon_base_view_inheritance_extension-18.0.1.0.0.2.dist-info/METADATA,sha256=SEWB0VCvznEBXsxMThQnO9UUv35LgLNlPqNBxVYSSYc,4743
|
|
25
|
+
odoo_addon_base_view_inheritance_extension-18.0.1.0.0.2.dist-info/WHEEL,sha256=9fEMia4zL7ZuZbnCOrcYogUhmn4XFIVaJ8G4YGI31xc,81
|
|
26
|
+
odoo_addon_base_view_inheritance_extension-18.0.1.0.0.2.dist-info/top_level.txt,sha256=QE6RBQ0QX5f4eFuUcGgU5Kbq1A_qJcDs-e_vpr6pmfU,4
|
|
27
|
+
odoo_addon_base_view_inheritance_extension-18.0.1.0.0.2.dist-info/RECORD,,
|