将两个字段转换为继承视图中的选项卡

时间:2018-01-21 11:20:16

标签: xml inheritance odoo odoo-view openerp-6

- 使用完整代码编辑 -

我有父视图:

# as part of the definition of f3
f3_argument1_default = []

x_global = [1]

# first call to f3
f3_call1_argument1 = f3_argument1_default
x_f3_call1 = f3_call1_argument1
x_f3_call1.append(5)                      # f3_argument1_default is now  [1,5]
f3_call1_return_value = x_f3_call1
x_global = f3_call1_return_value

# second call to f3
f3_call2_argument1 = f3_argument1_default
x_f3_call2 = f3_call2_argument1
x_f3_call2.append(5)                      # f3_argument1_default is now  [1,5,5]
f3_call2_return_value = x_f3_call2
x_global = f3_call2_return_value

所以我有一个子视图,我想在2页(标签)的笔记本中转换我的名字和名字2

我有正确的Xpath用标签替换这两个字段,但是我无法将bot页面放在同一个笔记本中:

 <record model="ir.ui.view" id="view_wpa_publication_form">
  <field name="name">WPA Publication View Form</field>
  <field name="model">wpa.publication</field>
  <field name="type">form</field>
  <field name="arch" type="xml">
    <form string="Publications">
      <group colspan="4" col="6">
          <field name="name" on_change="onchange_publication(name)" colspan="4"/>
          <field name="active"/>
          <field name="issn"/>
          <field name="supplier_id"/>
          <field name="periodicity"/>
      </group>
      <separator string="Editions" colspan="2"/>
      <separator string="Ad Categories" colspan="2"/>
      <field name="edition_ids" mode="tree" colspan="2" nolabel="1">
        <tree string="" editable="bottom">
          <field name="date"/>
        </tree>
        <form>  
            <field name="publication_id"/>
            <field name="date"/>
        </form>
      </field>
      <field name="category_ids" mode="tree" colspan="2" nolabel="1">
        <tree string="" editable="bottom">
          <field name="category_id"/>
          <field name="price"/>
          <field name="functioning"/>
        </tree>
        <form>  
            <field name="publication_id"/>
            <field name="category_id"/>
            <field name="price"/>
            <field name="functioning"/>
        </form>
      </field>            
    </form>
  </field>
</record>

如何更换两者并将它们放入笔记本中,然后添加第三个标签?现在我得到的是:enter image description here

1 个答案:

答案 0 :(得分:0)

试试这个:

<xpath expr="//separator[@string='String 3']" position="replace"/>
<xpath expr="//separator[@string='String 2']" position="replace"/>
<xpath expr="//field[@name='myField']" position="replace"/>
        <xpath expr="//field[@name='field']" position="replace">
            <notebook colspan="4">
                <page string="Page1">
                my stuff
                </page>
                <page string="Page2">
                  more stuff
                </page>
            </notebook>
         </xpath>