Reputation: 1289
I want to add a new field in a model. I create it in the python file and then I am going to show it in the view form:
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_order_form_extend" model="ir.ui.view">
<field name="name">view.order.form.extend</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale_stock.view_order_form_inherit_sale_stock"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='picking_policy']" position="after">
<field name="my_new_field"/>
</xpath>
</field>
</record>
</data>
</openerp>
When I install the module for the first time, the field appears and everything works fine. The problem comes when I try to update the module.
It gives an exception that says that field product_tmpl_id
doesn't exist.
How can it be possible? The first installation worked fine...
Note: If I uninstall the module, and then I install it again, it works fine. But then, when I try to update, it shows the error again...
Upvotes: 1
Views: 244
Reputation: 685
Regarding the xpath just simply use field tag.
For example,
<field name="picking_policy" position="after">
<field name="my_new_field"/>
</field>
Also just check your depends in manifest though. Don't forget to put upvote and tickmark this answer.
Upvotes: 0