İçereği Atla
Menü
This question has been flagged
2 Cevaplar
2674 Görünümler

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
Vazgeç
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
Vazgeç
Üretici

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
Vazgeç

<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 Cevaplar Görünümler Aktivite
0
Ağu 24
786
1
Haz 23
3132
0
Haz 23
1169
0
May 22
1816
0
May 17
3174