Odoo Help


hi i want to add a field on sale order could you help thanks

on 1/16/15, 5:26 AM 699 views

<?xml version="1.0" encoding="utf-8" ?>
 <record id="view_order_form" model="ir.ui.view">
  <field name="name">sale.order.form.Mine</field>
  <field name="model">sale.order</field>
 <field name="inherit_id" ref="sale.view_order_form">
 <field name="arch" type="xml">
<xpath expr="/form/sheet/group/group[2]/field[@name='date_order']" position="after">
  <field name="date_edition" />
  <field name="type_annonce" />

I recieve arch: Invalid XML for View Architecture!



| 5 3 6
Jakarta, Indonesia
On 1/16/15, 6:17 AM

inherit_id field should not contain anything else : <field name="inherit_id" ref="sale.view_order_form"/> and then remove one of the </field> tag after </xpath>.

abin c ibrahim
On 1/16/15, 6:26 AM

Hi Azzaly,

For adding a field you first create a field in the corresponding class.

Here you have 2 fields named date_edition & type_annonce.These 2 fields should be defined in the model sale.order as following,

'date_edition':fields.datetime('Date of Edition'),


Under this you should add a new field,

for example to add a field 'published_by' you should code as,

'published_by':fields.char(Published By'),

Then you can add the field in xml as foolows,

  <field name="published_by" />

After that upgrade the sale module...

Hope it helps....


On 1/16/15, 6:21 AM

it works  :D thanks a lot  Ivan

Kazim Mirza
On 1/16/15, 6:31 AM

Hello Azzaly

You cann simply use the inherit form view like below.

<record model="ir.ui.view" id="view_order_form_inherit"> #record id of xml is always unique.
            <field name="name">sale.order.form.Mine</field>
            <field name="model">sale.order</field>
            <field name="inherit_id" ref="sale.view_order_form"/>
            <field name="arch" type="xml">
                <field name="date_order" position="before">
                       <field name="date_edition" />
                       <field name="type_annonce" />

XPATH is used when the reference field is inside the one2many <from><tree> views.




           <field name="name"/> #if you want to add new field or replace this field so you need xpath because its inside the inline tree view#



           <field name="name"/>#if you want to add new field or replace this field so you need xpath because its inside the inline form view#



Hope that this answer will help you.

Please don't hesitate to ask any question regarding this.

Thank You

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.


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

1 follower(s)


Asked: 1/16/15, 5:26 AM
Seen: 699 times
Last updated: 11/4/15, 5:08 AM