tuấn anh phạm
tuấn anh phạm

Reputation: 81

Odoo 9.0 C How to add a new many2one field from an inherited view?

Could you guy please show me what is the right steps to follow when we want to add a new many2one field to an inherited view like account.invoice.order.

Upvotes: 0

Views: 136

Answers (1)

Charif DZ
Charif DZ

Reputation: 14751

It's like the same :

  <template id="new_id" inherit_id="module_name.qweb_template_id" name="Template name as you want">
      <!-- specify the target that you want to add the many2one field
              than the place after,before or inside -->
        <xpath expr="//target_where_you_want_to_add" position="after/before/inside">
            <field name="your_one_to_many_field_name" />
        </xpath>
  </template>

the hard part is targeting the write place like if you want to add the the field to a div tag inside a div with id ="div_id" and the div contain a class="class_name"

<xpath expr="//div[@id='div_id']/div[@class='class_name']" position="inside">

or a after a field inside that div named field1

<xpath expr="//div[@id='div_id']/div[@class='class_name']/field[@name='field1']" position="after">

or after a field that named field1

 <!-- // is like a shortcut -->
  <xpath expr="//field[@name='field1']" position="after">

so see who can you target the place that you want to put the field using tag names and properties like id,class,... (string is not supported in odoo 9)

Upvotes: 1

Related Questions