Skip to content

Commit 6a88440

Browse files
committed
[MIG] base_view_inheritance_extension: Migration to 19.0
1 parent e48f0d4 commit 6a88440

File tree

5 files changed

+58
-25
lines changed

5 files changed

+58
-25
lines changed

base_view_inheritance_extension/README.rst

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
.. image:: https://odoo-community.org/readme-banner-image
2+
:target: https://odoo-community.org/get-involved?utm_source=readme
3+
:alt: Odoo Community Association
4+
15
=========================
26
Extended view inheritance
37
=========================
@@ -13,17 +17,17 @@ Extended view inheritance
1317
.. |badge1| image:: https://img.shields.io/badge/maturity-Mature-brightgreen.png
1418
:target: https://odoo-community.org/page/development-status
1519
:alt: Mature
16-
.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png
20+
.. |badge2| image:: https://img.shields.io/badge/license-LGPL--3-blue.png
1721
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
1822
:alt: License: LGPL-3
1923
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github
20-
:target: https://github.com/OCA/server-tools/tree/18.0/base_view_inheritance_extension
24+
:target: https://github.com/OCA/server-tools/tree/19.0/base_view_inheritance_extension
2125
:alt: OCA/server-tools
2226
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23-
:target: https://translation.odoo-community.org/projects/server-tools-18-0/server-tools-18-0-base_view_inheritance_extension
27+
:target: https://translation.odoo-community.org/projects/server-tools-19-0/server-tools-19-0-base_view_inheritance_extension
2428
:alt: Translate me on Weblate
2529
.. |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=18.0
30+
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-tools&target_branch=19.0
2731
:alt: Try me on Runboat
2832

2933
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -83,7 +87,7 @@ Bug Tracker
8387
Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-tools/issues>`_.
8488
In case of trouble, please check there if your issue has already been reported.
8589
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:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
90+
`feedback <https://github.com/OCA/server-tools/issues/new?body=module:%20base_view_inheritance_extension%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
8791

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

@@ -125,6 +129,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
125129
mission is to support the collaborative development of Odoo features and
126130
promote its widespread use.
127131

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.
132+
This module is part of the `OCA/server-tools <https://github.com/OCA/server-tools/tree/19.0/base_view_inheritance_extension>`_ project on GitHub.
129133

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

base_view_inheritance_extension/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
44
{
55
"name": "Extended view inheritance",
6-
"version": "18.0.1.0.1",
6+
"version": "19.0.1.0.0",
77
"development_status": "Mature",
88
"author": "Therp BV,Odoo Community Association (OCA)",
99
"license": "LGPL-3",

base_view_inheritance_extension/models/ir_ui_view.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from lxml import etree
1010

1111
from odoo import api, models
12-
from odoo.osv import expression
12+
from odoo.fields import Domain
1313

1414

1515
def ast_dict_update(source, update):
@@ -163,9 +163,9 @@ def _inheritance_handler_attributes_domain_add(self, source, specs):
163163
self._var2str_domain_text(attribute_node.text.strip())
164164
)
165165
if join_operator == "OR":
166-
new_value = str(expression.OR([old_domain, new_domain]))
166+
new_value = str(Domain.OR([old_domain, new_domain]))
167167
else:
168-
new_value = str(expression.AND([old_domain, new_domain]))
168+
new_value = str(Domain.AND([old_domain, new_domain]))
169169
new_value = self._str2var_domain_text(new_value)
170170
old_value = "".join(old_value.splitlines())
171171
else:

base_view_inheritance_extension/static/description/index.html

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
55
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
6-
<title>Extended view inheritance</title>
6+
<title>README.rst</title>
77
<style type="text/css">
88

99
/*
@@ -360,16 +360,21 @@
360360
</style>
361361
</head>
362362
<body>
363-
<div class="document" id="extended-view-inheritance">
364-
<h1 class="title">Extended view inheritance</h1>
363+
<div class="document">
365364

365+
366+
<a class="reference external image-reference" href="https://odoo-community.org/get-involved?utm_source=readme">
367+
<img alt="Odoo Community Association" src="https://odoo-community.org/readme-banner-image" />
368+
</a>
369+
<div class="section" id="extended-view-inheritance">
370+
<h1>Extended view inheritance</h1>
366371
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
367372
!! This file is generated by oca-gen-addon-readme !!
368373
!! changes will be overwritten. !!
369374
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
370375
!! source digest: sha256:3164c7b67a9aa830f28bff20df0f54007a2cb55ec7e67009ccae8a1a2925a4e6
371376
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
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&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
377+
<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/license-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/server-tools/tree/19.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-19-0/server-tools-19-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=19.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
373378
<p>This module was written to make it simple to add custom operators for
374379
view inheritance.</p>
375380
<p><strong>Table of contents</strong></p>
@@ -387,7 +392,7 @@ <h1 class="title">Extended view inheritance</h1>
387392
</ul>
388393
</div>
389394
<div class="section" id="usage">
390-
<h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
395+
<h2><a class="toc-backref" href="#toc-entry-1">Usage</a></h2>
391396
<p><strong>Change a python dictionary (context for example)</strong></p>
392397
<pre class="code xml literal-block">
393398
<span class="nt">&lt;field</span><span class="w"> </span><span class="na">position=</span><span class="s">&quot;attributes&quot;</span><span class="nt">&gt;</span><span class="w">
@@ -416,29 +421,29 @@ <h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
416421
</pre>
417422
</div>
418423
<div class="section" id="known-issues-roadmap">
419-
<h1><a class="toc-backref" href="#toc-entry-2">Known issues / Roadmap</a></h1>
424+
<h2><a class="toc-backref" href="#toc-entry-2">Known issues / Roadmap</a></h2>
420425
<ul class="simple">
421426
<li>Support an <tt class="docutils literal">eval</tt> attribute for our new node types.</li>
422427
</ul>
423428
</div>
424429
<div class="section" id="bug-tracker">
425-
<h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
430+
<h2><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h2>
426431
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/server-tools/issues">GitHub Issues</a>.
427432
In case of trouble, please check there if your issue has already been reported.
428433
If you spotted it first, help us to smash it by providing a detailed and welcomed
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>
434+
<a class="reference external" href="https://github.com/OCA/server-tools/issues/new?body=module:%20base_view_inheritance_extension%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
430435
<p>Do not contact contributors directly about support or help with technical issues.</p>
431436
</div>
432437
<div class="section" id="credits">
433-
<h1><a class="toc-backref" href="#toc-entry-4">Credits</a></h1>
438+
<h2><a class="toc-backref" href="#toc-entry-4">Credits</a></h2>
434439
<div class="section" id="authors">
435-
<h2><a class="toc-backref" href="#toc-entry-5">Authors</a></h2>
440+
<h3><a class="toc-backref" href="#toc-entry-5">Authors</a></h3>
436441
<ul class="simple">
437442
<li>Therp BV</li>
438443
</ul>
439444
</div>
440445
<div class="section" id="contributors">
441-
<h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
446+
<h3><a class="toc-backref" href="#toc-entry-6">Contributors</a></h3>
442447
<ul class="simple">
443448
<li>Holger Brunn &lt;<a class="reference external" href="mailto:hbrunn&#64;therp.nl">hbrunn&#64;therp.nl</a>&gt;</li>
444449
<li>Ronald Portier &lt;<a class="reference external" href="mailto:rportier&#64;therp.nl">rportier&#64;therp.nl</a>&gt;</li>
@@ -456,18 +461,19 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
456461
</ul>
457462
</div>
458463
<div class="section" id="maintainers">
459-
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
464+
<h3><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h3>
460465
<p>This module is maintained by the OCA.</p>
461466
<a class="reference external image-reference" href="https://odoo-community.org">
462467
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
463468
</a>
464469
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
465470
mission is to support the collaborative development of Odoo features and
466471
promote its widespread use.</p>
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>
472+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-tools/tree/19.0/base_view_inheritance_extension">OCA/server-tools</a> project on GitHub.</p>
468473
<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>
469474
</div>
470475
</div>
471476
</div>
477+
</div>
472478
</body>
473479
</html>

base_view_inheritance_extension/tests/test_base_view_inheritance_extension.py

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,33 @@ class TestBaseViewInheritanceExtension(TransactionCase):
1313
def setUpClass(cls):
1414
super().setUpClass()
1515
cls.maxDiff = None
16+
cls.view = cls.env["ir.ui.view"].create(
17+
{
18+
"name": "Test Partner Simple Form Override",
19+
"type": "form",
20+
"model": "res.partner",
21+
"inherit_id": cls.env.ref("base.view_partner_simple_form").id,
22+
"arch": """
23+
<data>
24+
<xpath expr="." position="attributes">
25+
<attribute name="string">Partner form</attribute>
26+
</xpath>
27+
28+
<field name="parent_id" position="attributes">
29+
<attribute name="context" operation="update">
30+
{
31+
"default_email": "info@odoo-community.org",
32+
"default_company_id": allowed_company_ids[0]
33+
}
34+
</attribute>
35+
</field>
36+
</data>
37+
""",
38+
}
39+
)
1640

1741
def test_base_view_inheritance_extension(self):
18-
view_id = self.env.ref("base.view_partner_simple_form").id
19-
arch, _ = self.env["res.partner"]._get_view(view_id=view_id)
42+
arch, _ = self.env["res.partner"]._get_view(view_id=self.view.id)
2043
# Verify normal attributes work
2144
self.assertEqual(arch.xpath("//form")[0].get("string"), "Partner form")
2245
# Verify our extra context key worked

0 commit comments

Comments
 (0)