Odoo Help

0

xpath after field div tag

By
Prakash
on 11/18/13, 10:37 AM 3,568 views
  <form string="Contact" version="7.0">
        <header>
            <field name="state" widget="statusbar" statusbar_visible="draft,assigned,cancel"/>
        </header>
        <notebook>
          <page string="Contact Details"> 
              <group>
               <group col="4" colspan="2">
                 <label for="name" class="custom_allign"/>
                    <div>
                    <field name="name"/>
                    </div>  
                   <label for="phone_no" class="custom_allign"/>
                    <div>
                     <field name="phone_no" class="oe_inline"/> 
                    </div>
                </group>
                <group col="6" colspan="2">
                  <label for="dob" class="custom_allign"/>
                  <div>
                    <field name="dob"/>
                  </div>
                  <label for="date" class="custom_allign"/>
                  <div>
                      <field name="date"/>
                  </div>  
                 </group>
               <group col="4" colspan="2">
                    <label for="address1" class="custom_allign"/>
                    <div>
                   <field name="address1"/>
                    </div>
                    <label for="address3" class="custom_allign"/>
                    <div>
                    <field name="address3"/>
                    </div>
              </group>
              </group>
             </page>

Based on above code using xpath how to set address1 field after address2 ?

    <<field name="address1" position="after">
        <label for="address2"/>
            <field  name="address2"/>       
        </field>

The above code added before div tag using xml how to set above code

2
Grover Menacho
On 11/18/13, 11:06 AM

Sometimes there are no possibilities for xpath, well I don't know any... you have to do this:

<xpath expr="//label[@for='address3']" position="before">
    <label for="address2"/>
        <field  name="address2"/>       
    </xpath>

Thanks Grover Menacho its working

Prakash
on 11/19/13, 5:49 AM

Great, please mark the answer as correct if it worked for you. Thanks

GH Mediacloud, Grover Menacho
on 11/19/13, 9:09 AM

Many thanks Grover !!!

+1

Ankit H Gandhi(AHG)
on 6/19/16, 8:43 AM
0
Ankit H Gandhi(AHG)
On 6/29/17, 7:31 AM

Hi Prakash,

Please use below code.

use indexes, like

<xpath expr="//div[1]/div[3]" position="name of position">

     write your code here..

</xpath>

Exaplanation above code:

indexes 1 and 3 are indicating position numbers. "//div[1]" should be first div in a inherited view.

accordingly "//div[1]/div[3]" - third child div of the first div in the inherited view.

Hope this help you.

Best Thanks,

Ankit H Gandhi.

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)

Stats

Asked: 11/18/13, 10:37 AM
Seen: 3568 times
Last updated: 6/29/17, 7:31 AM