Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
3167 Lượt xem

I would like to display the internal reference number for each product in the e-commerce shop. I added this to the templates.xml:



```





template



```


But when we update the website_sale module, we get this error message:
```Element '' cannot be located in parent view```

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Try to add the below at the end of the templates.xml, this will show internal reference in shop page for all products and it will add toggle button in customize to active/inactive it:

<template id="products_item_internal_reference" inherit_id="website_sale.products_item" active="True"
customize_show="True" name="Product Internal Reference">
<xpath expr="//*[hasclass('product_price')]" position="before">
<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>

Note: Modify the Odoo module is not the best practice because if you update it to the latest revision, your added code will be removed so it's better to develop your custom module.



Ảnh đại diện
Huỷ bỏ
Tác giả

This worked. Thank you!

Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 12 22
32240
0
thg 7 20
2206
0
thg 6 22
2372
1
thg 7 21
5404
0
thg 8 24
1570