[MIG] base_view_inheritance_extension to 10.0

pull/2494/head
lfreeke 2017-08-31 14:11:29 +02:00 committed by Enric Tobella
parent 126dab9e5c
commit 2d4ba31965
5 changed files with 18 additions and 17 deletions

View File

@ -14,7 +14,7 @@ Usage
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot :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) Change a python dictionary (context for example)
------------------------------------------------ ------------------------------------------------

View File

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

View File

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

View File

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

View File

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