Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
2 Replies
3220 Tampilan

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
Buang
Jawaban Terbai

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
Buang
Penulis

Thanks!

Jawaban Terbai

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
Buang

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

Post Terkait Replies Tampilan Aktivitas
0
Agu 24
1499
1
Jun 23
3824
0
Jun 23
1699
0
Mei 22
2446
0
Mei 17
3662