Skip to content

Commit

Permalink
Remove the "move" feature which is now native
Browse files Browse the repository at this point in the history
Use https in URL to licence
  • Loading branch information
alexis-via authored and etobella committed Dec 6, 2022
1 parent 5ae9ffa commit a27f029
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 35 deletions.
1 change: 0 additions & 1 deletion base_view_inheritance_extension/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
from . import models
2 changes: 1 addition & 1 deletion base_view_inheritance_extension/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright 2016 Therp BV <https://therp.nl>
# Copyright 2018 Tecnativa - Sergio Teruel
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
{
"name": "Extended view inheritance",
"version": "12.0.1.0.0",
Expand Down
2 changes: 0 additions & 2 deletions base_view_inheritance_extension/demo/ir_ui_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
<page string="Phone numbers" name="phone_book" />
</notebook>
</form>
<xpath expr="//field[@name='phone']" position="move" target="//page[@name='phone_book']" />
<xpath expr="//field[@name='mobile']" position="move" target="//page[@name='phone_book']" />
</field>
</record>
</odoo>
1 change: 0 additions & 1 deletion base_view_inheritance_extension/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
from . import ir_ui_view
15 changes: 1 addition & 14 deletions base_view_inheritance_extension/models/ir_ui_view.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright 2016 Therp BV <https://therp.nl>
# Copyright 2018 Tecnativa - Sergio Teruel
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from lxml import etree
from odoo import api, models, tools
from odoo.tools.safe_eval import safe_eval
Expand Down Expand Up @@ -115,19 +115,6 @@ def inheritance_handler_attributes_python_dict(
node.attrib[attribute_node.get('name')] = str(python_dict)
return source

@api.model
def inheritance_handler_xpath(self, source, specs, inherit_id):
if not specs.get('position') == 'move':
return super(IrUiView, self).apply_inheritance_specs(
source, specs, inherit_id
)
node = self.locate_node(source, specs)
target_node = self.locate_node(
source, etree.Element(specs.tag, expr=specs.get('target'))
)
target_node.append(node)
return source

@api.model
def inheritance_handler_attributes_list_add(
self, source, specs, inherit_id
Expand Down
15 changes: 6 additions & 9 deletions base_view_inheritance_extension/readme/USAGE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,6 @@
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
<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)**

.. code-block:: xml
Expand All @@ -34,3 +25,9 @@ element first, then move the node youwant to wrap there.
<attribute name="$attribute" operation="list_remove">
$remove_value(s)
</attribute>
**Move an element in the view**

This feature is now native, cf the `official Odoo documentation <https://www.odoo.com/documentation/12.0/reference/views.html#inheritance-specs>`_.


1 change: 0 additions & 1 deletion base_view_inheritance_extension/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
from . import test_base_view_inheritance_extension
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright 2016 Therp BV <http://therp.nl>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from lxml import etree
from odoo.tests.common import TransactionCase

Expand All @@ -23,11 +23,6 @@ def test_base_view_inheritance_extension(self):
"context.get('company_id', context.get('company'))" in
view.xpath('//field[@name="parent_id"]')[0].get('context')
)
# verify we moved the child_ids field
self.assertEqual(
view.xpath('//field[@name="mobile"]')[0].getparent(),
view.xpath('//page[@name="phone_book"]')[0]
)

def test_list_add(self):
view_model = self.env['ir.ui.view']
Expand Down

0 comments on commit a27f029

Please sign in to comment.