I am working on a new module that consists of adding the product weight and the total weight in the stock_picking report, but I have a problem with my xpaths.
The error : lxml.etree.XPathSyntaxError: Invalid predicate
I have looked at them very carefully but I can't find what is wrong. Could you please help me?
The code :
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_picking_inherit" inherit_id="stock.report_picking">
<xpath expr="//td[contains(@t-if, 'has_barcode') and contains(@class, 'text-center')]" position="after">
<td>
<span t-if="o.state != 'done'" t-esc="ml.product_id.weight"/>
<span t-if="o.state == 'done'" t-esc="ml.product_id.weight"/>
</td>
</xpath>
<xpath expr="//table[contains(@t-if, 'o.move_line_ids') and contains(@t-if, 'and') and contains(@t-if, 'o.move_ids_without_package')" position="after">
<span t-field="o.stock_total_weight"/>
</xpath>
</template>
</odoo>
Thanks by advance...
The "predicate" is the part of the xpath in square brackets, so you want to be looking for the problem there. Looking closer, you have a missing closing square bracket in //table[contains(@t-if, 'o.move_line_ids') and contains(@t-if, 'and') and contains(@t-if, 'o.move_ids_without_package')
Try it as
<xpath expr="//table[contains(@t-if, 'o.move_line_ids') and contains(@t-if, 'and') and contains(@t-if, 'o.move_ids_without_package')]" position="after">