Skip to Content
Menu
This question has been flagged
2 Replies
2205 Views

good day everyone,


I a custom module we want to add field inheriting a class, however we don't find the proper way to xpath to it.  we tried both ways and got error "xpath cannot be located in parent view"


<template id="products_item_inters" inherit_id="website_sale.products_item">



 <!--<xpath expr="//div[hasclass('p-2 o_wsale_product_information_text')]" position="inside"> -->



 <xpath expr="//div[@id='p-2 o_wsale_product_information_text']" position="inside">



  <h6 class="o_wsale_products_item_title mb-1">



   <a class="text-primary text-decoration-none" itemprop="default_code" t-att-href="product_href" t-att-content="product.default_code" t-field="product.default_code" />



  </h6>



 </xpath>



</template>
















Avatar
Discard
Best Answer

I can't post code :(


Use for example H6-Title-Element o_wsale_products_item_title inside that div for xpath and work with position after, before or replace instead of inside.


Hope that helps

Avatar
Discard
Author

Thanks!

Best Answer

Dear Christian Kubicki and Avash,
I can not write comment, thats why writing as an answer. and code is in comments. Sorry.

Me too have same issue i want to replace website_sale.products_item template last span but its keep on giving me "Extra content at the end of the document" Error.
Could someone let me know what mistake am i doing here.
Thanks.

Avatar
Discard

<template id="products_item_intert" inherit_id="website_sale.products_item">
<xpath expr="//span[last()]" position="replace">
<t t-set="pqty" t-value='int(product.qty_available)'/>
<span t-out="str((td_product['ribbon']['html'] or '') + ' ' + str(pqty) or '')" t-attf-class="o_ribbon #{bg_class}" t-attf-style="#{text_color and ('color: %s; ' % text_color)}#{bg_color and 'background-color:' + bg_color}" />
</xpath>
</template>​

Related Posts Replies Views Activity
0
Aug 24
181
1
Jun 23
2343
0
Jun 23
697
0
May 22
1368
0
May 17
2779