Skip to Content
Menú
This question has been flagged
3 Respostes
5959 Vistes

is it possible to hide the prices of the variants? (example + 12 €)

Avatar
Descartar
Autor

Where can I change the info for the product pages of the different websites?

Best Answer

Hi, It is possible to do this even out of the box without custom code. Please review the following Post.

https://www.odoo.com/forum/help-1/hide-extra-price-badge-on-website-228049

Avatar
Descartar
Best Answer

you can try like this in odoo version 10:

in xml file

<data inherit_id="website_sale.product_variants">

      <xpath expr="//span[@class='badge']" position="replace">

        <span class="badge tr_hide" t-if="variant_id.price_extra">

          <t t-esc="variant_id.price_extra &gt; 0 and '+' or ''"/><span t-field="variant_id.price_extra" style="white-space: nowrap;" t-options="{                 &quot;widget&quot;: &quot;monetary&quot;,                 &quot;from_currency&quot;: product.currency_id,                 &quot;display_currency&quot;: website.currency_id               }"/>

        </span>

      </xpath>

    </data>

in css :

.tr_hide{

    display: none !important;

}


It will hide the price from variant


Avatar
Descartar
Best Answer

Hello,

Yes, it is possible.

You can do that by append attribute "invisible" in the XML tag.

Check the following codes for hiding, the XML tags in Form, Tree, Kanban Views.

Code is working in my environment. Maybe some simple changes needed for working in your environment. (Mostly in Kanban view)

Anyway, you will get an idea about these things.


<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- for form-->
<record id="product_product_form_inherit" model="ir.ui.view">
<field name="name">product.product.form.inherit</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='lst_price']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//label[@for='standard_price']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//field[@name='standard_price']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
</field>
</record>
<!-- for tree-->
<record id="product_product_tree_inherit" model="ir.ui.view">
<field name="name">product.product.tree.inherit</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_product_tree_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='lst_price']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//field[@name='standard_price']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
</field>
</record>
<!-- for kanban-->
<record id="product_product_kanban_inherit" model="ir.ui.view">
<field name="name">product.product.kanban.inherit</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_kanban_view"/>
<field name="arch" type="xml">
<xpath expr="//div[@class='oe_kanban_details']/ul" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
</field>
</record>
</odoo>




Thanks & Regards

Avinash N K

Avatar
Descartar
Autor

I would like to do this only on the websites and not on odoo.

Autor

Where can I change the info for the product pages of the different websites?

Related Posts Respostes Vistes Activitat
3
de maig 17
6459
7
de març 16
7457
0
de des. 21
1995
1
de març 16
4443
2
d’ag. 25
224