In Odoo 10, I'm trying to replace the content of this template by a xpath expression. What I want to do is just select the first with "Weight" and replace it by "test"
<odoo>
<template id="report_delivery_document2" inherit_id="stock.report_delivery_document">
<xpath expr="//th[@name='td_sched_date_h']" position="after">
<th t-if="o.picking_type_id.code == 'outgoing' and o.carrier_id"><strong>Carrier</strong></th>
<th t-if="o.weight"><strong>Weight</strong></th>
</xpath>
<xpath expr="//td[@name='td_sched_date']" position="after">
<td t-if="o.picking_type_id.code == 'outgoing' and o.carrier_id">
<span t-field="o.carrier_id"/>
</td>
<td t-if="o.weight">
<span t-field="o.weight"/>
<span t-field="o.weight_uom_id"/>
</td>
</xpath>
</template>
In my module I've trying this code :
<odoo>
<template id="report_delivery_document3" inherit_id="stock_delivery_slip.report_sale_delivery_slip_createch">
<!-- <xpath expr="//th[contains(., 'Weight')]" position="replace"> -->
<!-- <xpath expr="//th/strong[text()='Weight']" position="replace"> -->
<th>test</th>
<!-- </xpath> -->
</template>
But nothing works,How can I select the "Weight" whithout adding attribute in "report_delivery_document2" ?
Thanks in advance.
You can simply edit translation for that view (report_delivery_document2), and change :
<strong>Weight</strong>
into :
<strong>test</strong>
But if you want to keep xpath, just do this :
<xpath expr="//th[@t-if='o.weight']" position="replace">
Hope this will help.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.