Remove the "move" feature which is now native
Use https in URL to licencepull/2494/head
parent
5ae9ffa453
commit
a27f029be7
|
@ -1,2 +1 @@
|
||||||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
|
|
||||||
from . import models
|
from . import models
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Copyright 2016 Therp BV <https://therp.nl>
|
# Copyright 2016 Therp BV <https://therp.nl>
|
||||||
# Copyright 2018 Tecnativa - Sergio Teruel
|
# 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",
|
"name": "Extended view inheritance",
|
||||||
"version": "12.0.1.0.0",
|
"version": "12.0.1.0.0",
|
||||||
|
|
|
@ -20,8 +20,6 @@
|
||||||
<page string="Phone numbers" name="phone_book" />
|
<page string="Phone numbers" name="phone_book" />
|
||||||
</notebook>
|
</notebook>
|
||||||
</form>
|
</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>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|
|
@ -1,2 +1 @@
|
||||||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
|
|
||||||
from . import ir_ui_view
|
from . import ir_ui_view
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Copyright 2016 Therp BV <https://therp.nl>
|
# Copyright 2016 Therp BV <https://therp.nl>
|
||||||
# Copyright 2018 Tecnativa - Sergio Teruel
|
# 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 lxml import etree
|
||||||
from odoo import api, models, tools
|
from odoo import api, models, tools
|
||||||
from odoo.tools.safe_eval import safe_eval
|
from odoo.tools.safe_eval import safe_eval
|
||||||
|
@ -115,19 +115,6 @@ class IrUiView(models.Model):
|
||||||
node.attrib[attribute_node.get('name')] = str(python_dict)
|
node.attrib[attribute_node.get('name')] = str(python_dict)
|
||||||
return source
|
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
|
@api.model
|
||||||
def inheritance_handler_attributes_list_add(
|
def inheritance_handler_attributes_list_add(
|
||||||
self, source, specs, inherit_id
|
self, source, specs, inherit_id
|
||||||
|
|
|
@ -10,15 +10,6 @@
|
||||||
Note that views are subject to evaluation of xmlids anyways, so if you need
|
Note that views are subject to evaluation of xmlids anyways, so if you need
|
||||||
to refer to some xmlid, say ``%(xmlid)s``.
|
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)**
|
**Add to values in a list (states for example)**
|
||||||
|
|
||||||
.. code-block:: xml
|
.. code-block:: xml
|
||||||
|
@ -34,3 +25,9 @@ element first, then move the node youwant to wrap there.
|
||||||
<attribute name="$attribute" operation="list_remove">
|
<attribute name="$attribute" operation="list_remove">
|
||||||
$remove_value(s)
|
$remove_value(s)
|
||||||
</attribute>
|
</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,2 +1 @@
|
||||||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
|
|
||||||
from . import test_base_view_inheritance_extension
|
from . import test_base_view_inheritance_extension
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Copyright 2016 Therp BV <http://therp.nl>
|
# 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 lxml import etree
|
||||||
from odoo.tests.common import TransactionCase
|
from odoo.tests.common import TransactionCase
|
||||||
|
|
||||||
|
@ -23,11 +23,6 @@ class TestBaseViewInheritanceExtension(TransactionCase):
|
||||||
"context.get('company_id', context.get('company'))" in
|
"context.get('company_id', context.get('company'))" in
|
||||||
view.xpath('//field[@name="parent_id"]')[0].get('context')
|
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):
|
def test_list_add(self):
|
||||||
view_model = self.env['ir.ui.view']
|
view_model = self.env['ir.ui.view']
|
||||||
|
|
Loading…
Reference in New Issue