You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
133 lines
6.4 KiB
133 lines
6.4 KiB
<?xml version = "1.0" encoding = "UTF-8" ?>
|
|
<odoo>
|
|
<!-- Hide Add To Cart Button and quantity selector for public users -->
|
|
<template id="product_hide" inherit_id="website_sale.product">
|
|
<xpath expr="//div[@id='o_product_terms_and_share']" position="before">
|
|
<div class="alert alert-info"
|
|
t-if="login_user">
|
|
<i class="fa fa-info-circle"/>
|
|
<span>Please Log in to see buy options.</span>
|
|
</div>
|
|
</xpath>
|
|
<xpath expr="//a[@id='add_to_cart']" position="attributes">
|
|
<attribute name="t-if">
|
|
not request.env.user._is_public() or
|
|
(request.env.user._is_public() and not
|
|
request.env['ir.config_parameter'].sudo().get_param('website_hide_button.hide_cart'))
|
|
</attribute>
|
|
</xpath>
|
|
</template>
|
|
<!-- Hide Add To Cart button for guest users -->
|
|
<template id="product" inherit_id="website_sale.product">
|
|
<xpath expr="//div[@id='add_to_cart_wrap']" position="attributes">
|
|
<attribute name="t-if">login_user == False</attribute>
|
|
</xpath>
|
|
</template>
|
|
<!-- Hide Product price in price_widget -->
|
|
<template id="product_price_hide" inherit_id="website_sale.product_price">
|
|
<xpath expr="//div[@itemprop='offers']" position="attributes">
|
|
<attribute name="t-if">not request.env.user._is_public() or
|
|
(request.env.user._is_public() and not
|
|
request.env['ir.config_parameter'].sudo().get_param('website_hide_button.hide_price'))
|
|
</attribute>
|
|
</xpath>
|
|
</template>
|
|
<!-- Cart_hide -->
|
|
<template id="header_cart_link_hide"
|
|
inherit_id="website_sale.header_cart_link">
|
|
<xpath expr="//a[@href='/shop/cart']" position="attributes">
|
|
<attribute name="t-if">not request.env.user._is_public() or
|
|
(request.env.user._is_public() and not
|
|
request.env['ir.config_parameter'].sudo().get_param('website_hide_button.hide_cart'))
|
|
</attribute>
|
|
</xpath>
|
|
</template>
|
|
<!-- Hide details section in search bar for hide price -->
|
|
<template id="search_hide" inherit_id="website_sale.search">
|
|
<xpath expr="//t[@t-set='display_detail']" position="replace">
|
|
<t t-if="not request.env.user._is_public() or (request.env.user._is_public() and not request.env['ir.config_parameter'].sudo().get_param('website_hide_button.hide_price'))">
|
|
<t t-set="display_detail" t-valuef="true"/>
|
|
</t>
|
|
<t t-else="">
|
|
<t t-set="display_detail" t-valuef="false"/>
|
|
</t>
|
|
</xpath>
|
|
</template>
|
|
<!-- Hide price Filter -->
|
|
<template id="filter_products_price_hide"
|
|
inherit_id="website_sale.filter_products_price">
|
|
<xpath expr="//div[@id='o_wsale_price_range_option']"
|
|
position="attributes">
|
|
<attribute name="t-if">
|
|
not request.env.user._is_public() or
|
|
(request.env.user._is_public() and not
|
|
request.env['ir.config_parameter'].sudo().get_param('website_hide_button.hide_price'))
|
|
</attribute>
|
|
</xpath>
|
|
</template>
|
|
<!-- Product Info Page hiding price related attributes -->
|
|
<template id="products_item_hide" inherit_id="website_sale.products_item"
|
|
priority="99">
|
|
<xpath expr="//div[@itemprop='offers']" position="attributes">
|
|
<attribute name="t-if">
|
|
product.product_variant_ids and (not
|
|
request.env.user._is_public() or (request.env.user._is_public()
|
|
and not
|
|
request.env['ir.config_parameter'].sudo().get_param('website_hide_button.hide_price')))
|
|
</attribute>
|
|
</xpath>
|
|
<xpath expr="//div[hasclass('o_wsale_product_btn')]"
|
|
position="attributes">
|
|
<attribute name="t-if">
|
|
product.product_variant_ids and (not
|
|
request.env.user._is_public() or (request.env.user._is_public()
|
|
and not
|
|
request.env['ir.config_parameter'].sudo().get_param('website_hide_button.hide_price')))
|
|
</attribute>
|
|
</xpath>
|
|
</template>
|
|
<!-- Hide Quantity selection -->
|
|
<template id="product_quantity_hide"
|
|
inherit_id="website_sale.product_quantity">
|
|
<xpath expr="//div[contains(@t-attf-class, 'css_quantity')]"
|
|
position="attributes">
|
|
<attribute name="t-if">
|
|
not request.env.user._is_public() or
|
|
(request.env.user._is_public() and not
|
|
request.env['ir.config_parameter'].sudo().get_param('website_hide_button.hide_cart'))
|
|
</attribute>
|
|
</xpath>
|
|
</template>
|
|
<!-- Hide Price in Search box content -->
|
|
<template id="website_search_box_hide"
|
|
inherit_id="website.website_search_box">
|
|
<xpath expr="//input[@name='search']" position="attributes">
|
|
<attribute name="t-att-data-display-price">
|
|
website and (not request.env.user._is_public() or
|
|
(request.env.user._is_public() and not
|
|
request.env['ir.config_parameter'].sudo().get_param('website_hide_button.hide_price')))
|
|
</attribute>
|
|
</xpath>
|
|
</template>
|
|
<!-- Hide price in Dynamic Product Filter -->
|
|
<template id="price_dynamic_filter_template_product_product"
|
|
inherit_id="website_sale.price_dynamic_filter_template_product_product">
|
|
<xpath expr="//span[hasclass('fw-bold')]" position="attributes">
|
|
<attribute name="t-if">(not request.env.user._is_public() or
|
|
(request.env.user._is_public() and not
|
|
request.env['ir.config_parameter'].sudo().get_param('website_hide_button.hide_price')))
|
|
</attribute>
|
|
</xpath>
|
|
</template>
|
|
<!-- Hide extra badge related to price in price tag -->
|
|
<template id="badge_extra_price_hide"
|
|
inherit_id="website_sale.badge_extra_price">
|
|
<xpath expr="//t[@t-name='website_sale.badge_extra_price']"
|
|
position="attributes">
|
|
<attribute name="t-if">not request.env.user._is_public() or
|
|
(request.env.user._is_public() and not
|
|
request.env['ir.config_parameter'].sudo().get_param('website_hide_button.hide_price'))
|
|
</attribute>
|
|
</xpath>
|
|
</template>
|
|
</odoo>
|
|
|