简体   繁体   中英

Convert two fields to tabs in an inherited view

-edited with full code-

I have parent view:

 <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>

So I have a child view where I want to convert my name and my name 2 in a notebook with 2 pages (tabs)

I have correct Xpath replacing both fields with tabs, but I'm unable to put bot pages inside the same notebook:

        <xpath expr="//separator[@string='Editions']" position="replace"/>
        <xpath expr="//field[@name='edition_ids']" position="replace">
            <notebook colspan="4">
                <page string="Editions">
                  <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>                            
                </page>
                <page string="Ad Categories">
                  <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>
                </page>
                <page string="Awards">
                  <field name="publication_id" mode="tree" colspan="2" nolabel="1">
                    <tree string="" editable="bottom">
                      <field name="award"/>
                    </tree>
                    <form>  
                        <field name="award"/>

                    </form>
                  </field>                            
                </page>
                </notebook>
        </xpath>

        <xpath expr="//separator[@string='Ad Categories']" position="replace"/>
        <xpath expr="//field[@name='category_ids']" position="replace">
        <notebook colspan="4">
        </notebook>     
        </xpath>

How to replace both and put them inside a notebook, adding then a third tab? For now What I get is this: 在此处输入图片说明

Try this:

<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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM