Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
2 Antwoorden
3314 Weergaven

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
Annuleer
Beste antwoord

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
Annuleer
Auteur

Thanks!

Beste antwoord

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
Annuleer

<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>​

Gerelateerde posts Antwoorden Weergaven Activiteit
0
aug. 24
1572
1
jun. 23
3933
0
jun. 23
1746
0
mei 22
2536
0
mei 17
3751