Browse Source

[MIG] base_view_inheritance_extension to 10.0

pull/1529/head
lfreeke 7 years ago
committed by Raphaël Valyi
parent
commit
942eec3e85
  1. 2
      base_view_inheritance_extension/README.rst
  2. 2
      base_view_inheritance_extension/__manifest__.py
  3. 21
      base_view_inheritance_extension/demo/ir_ui_view.xml
  4. 2
      base_view_inheritance_extension/models/ir_ui_view.py
  5. 8
      base_view_inheritance_extension/tests/test_base_view_inheritance_extension.py

2
base_view_inheritance_extension/README.rst

@ -14,7 +14,7 @@ Usage
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/149/9.0
:target: https://runbot.odoo-community.org/runbot/149/10.0
Change a python dictionary (context for example)
------------------------------------------------

2
base_view_inheritance_extension/__openerp__.py → base_view_inheritance_extension/__manifest__.py

@ -3,7 +3,7 @@
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
{
"name": "Extended view inheritance",
"version": "9.0.1.1.0",
"version": "10.0.1.0.0",
"author": "Therp BV,Odoo Community Association (OCA)",
"license": "LGPL-3",
"category": "Hidden/Dependency",

21
base_view_inheritance_extension/demo/ir_ui_view.xml

@ -1,9 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<record id="view_partner_form" model="ir.ui.view">
<odoo>
<record id="view_partner_simple_form" model="ir.ui.view">
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form" />
<field name="inherit_id" ref="base.view_partner_simple_form" />
<field name="arch" type="xml">
<xpath expr="." position="attributes">
<attribute name="string">Partner form</attribute>
@ -12,11 +11,13 @@
<attribute name="context" operation="python_dict" key="default_name">'The company name'</attribute>
<attribute name="context" operation="python_dict" key="default_company_id">context.get('company_id', context.get('company'))</attribute>
</field>
<notebook position="inside">
<page string="A new page" name="my_new_page" />
</notebook>
<xpath expr="//field[@name='child_ids']" position="move" target="//page[@name='my_new_page']" />
<form position="inside">
<notebook>
<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>
</data>
</openerp>
</odoo>

2
base_view_inheritance_extension/models/ir_ui_view.py

@ -2,7 +2,7 @@
# © 2016 Therp BV <http://therp.nl>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
from lxml import etree
from openerp import api, models, tools
from odoo import api, models, tools
class UnquoteObject(str):

8
base_view_inheritance_extension/tests/test_base_view_inheritance_extension.py

@ -2,13 +2,13 @@
# © 2016 Therp BV <http://therp.nl>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
from lxml import etree
from openerp.tests.common import TransactionCase
from odoo.tests.common import TransactionCase
class TestBaseViewInheritanceExtension(TransactionCase):
def test_base_view_inheritance_extension(self):
view_id = self.env.ref('base.view_partner_form').id
view_id = self.env.ref('base.view_partner_simple_form').id
fields_view_get = self.env['res.partner'].fields_view_get(
view_id=view_id
)
@ -26,8 +26,8 @@ class TestBaseViewInheritanceExtension(TransactionCase):
)
# verify we moved the child_ids field
self.assertEqual(
view.xpath('//field[@name="child_ids"]')[0].getparent(),
view.xpath('//page[@name="my_new_page"]')[0]
view.xpath('//field[@name="mobile"]')[0].getparent(),
view.xpath('//page[@name="phone_book"]')[0]
)
def test_list_add(self):

Loading…
Cancel
Save