Using <xpath> in OpenERP/ odoo


<template id="report_saleorder_document">
  <t t-call="report.external_layout">
    <div class="page">
      <h2>
        <span t-field="doc.name"/>
      </h2>
      <table class="table table-condensed">
        <thead>
          <tr>
            <th>Description</th>
            <th class="text-right">Quantity</th>
            <th class="text-right">Unit Price</th>
            <th t-if="display_discount" class="text-right"</th>
            <th class="text-right">Taxes</th>
            <th class="text-right" name="price_subtotal_head">Price</th>
          </tr>
        </thead>
      </table>
    </div>
  </t>
</template>

Using to add new label:

Option 1:

<xpath expr="//th[@name='price_subtotal_head']" position="after">
  <th class="text-right">New Label</th>
</xpath>

Option 2:

<xpath expr="//t/div/table/thead/tr/th[5]" position="after">
  <th class="text-right">New Label</th>
</xpath>

Option 3:

<xpath expr="//t/div/table/thead/tr/th[last()]" position="after">
  <th class="text-right">New Label</th>
</xpath>
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s