Reputation: 39
I need to find correct XPath to product id on Odoo 9. I have tried this but it is complaining that "string" has some problem.
Error details:
View inheritance may not use attribute 'string' as a selector.
Code:
<xpath expr="//page[@string='Order Lines']/field[@name='order_line']/form[@string='Sales Order Lines']/group/group/field[@name='product_id']" position="before">
<field name="image_small" widget="image"/>
</xpath>
Upvotes: 2
Views: 3690
Reputation: 14746
In odoo v9, you does not permitted to use string as selector in xpath. So it is good practice to use name as selector in xpath.
You should try following :
<xpath expr="//page/field[@name='order_line']/form/group/group/field[@name='product_id']" position="before">
<field name="image_small" widget="image"/>
</xpath>
Or you can also write xpath like that,
<xpath expr="//field[@name='order_line']//form//field[@name='product_id']" position="before">
<field name="image_small" widget="image"/>
</xpath>
Upvotes: 2
Reputation: 25072
Is there really a need for such a detailed selector? It seems that selector as simple as this would do the job perfectly well:
<xpath expr="//field[@name='product_id']" position="before">
<field name="image_small" widget="image"/>
</xpath>
Upvotes: 2