Odoo Help

Welcome!

This community 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.

0

Can someone explain me the xpath?

By
wizardz
on 10/29/15, 11:21 AM 408 views

I'm writing a modul, now I can add a field like this:

<record id="sale_order_form_ext_view" model="ir.ui.view">

<field name="name">sale.order.form.ext</field>

<field name="model">sale.order</field>

<field name="type">form</field>

<field name="inherit_id" ref="sale.view_order_form" />

<field name="arch" type="xml">

<xpath expr="//field[@name='carrier_id']" position="before">

<field string="Liefertermin" name="delivery_date" placeholder="Liefertermin"/>

<field string="Lieferung" name="delivery" placeholder="Lieferung" />

</xpath>

</field>

</record>

 


But when I want to put it under the order_policy, it doesn't work : 

<record id="sale_order_form_ext_view" model="ir.ui.view">

<field name="name">sale.order.form.ext</field>

<field name="model">sale.order</field>

<field name="type">form</field>

<field name="inherit_id" ref="sale.view_order_form" />

<field name="arch" type="xml">

<xpath expr="//field[@name='order_policy']" position="before">

<field string="Liefertermin" name="delivery_date" placeholder="Liefertermin"/>

<field string="Lieferung" name="delivery" placeholder="Lieferung" />

</xpath>

</field>

</record>

 


Why is that so difficult? The field order_policy is at "other information" but on the same sale_order

1

zbik

--zbik--
5976
| 6 4 7
Lodz, Poland
--zbik--


zbik
On 10/29/15, 12:18 PM

Field carrier_id is added by the module delivery - view: delivery.sale.order_withcarrier.form.view (inherit sale.view_order_form)

Field order_policy is added by the module sale_stock - view: sale.order.form.sale.stock (inherit sale.view_order_form)

If your module does not depend on the module sale_stock you get the problem. Verify __openerp__.py and depends in  your module.



0
wizardz
On 10/30/15, 3:39 AM

Ok I found the solution, I was all time in inherid_id: 

<field name="inherit_id" ref="sale.view_order_form" />

But I need to take the real inherid_path of the field like this:


<field name="inherit_id" ref="sale_stock.view_order_form_inherit" />


So thanks for your help..

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 10/29/15, 11:21 AM
Seen: 408 times
Last updated: 10/30/15, 4:02 AM