Browse Source

Sep 23: [FIX] Bug Fixed 'website_hide_button'

pull/332/head
Cybrosys Technologies 7 months ago
parent
commit
5438e85440
  1. 1
      website_hide_button/__init__.py
  2. 3
      website_hide_button/__manifest__.py
  3. 17
      website_hide_button/controllers/website_sale.py
  4. 6
      website_hide_button/doc/RELEASE_NOTES.md
  5. 22
      website_hide_button/models/__init__.py
  6. 61
      website_hide_button/models/res_config_settings.py
  7. BIN
      website_hide_button/static/description/assets/screenshots/0.png
  8. 431
      website_hide_button/static/description/index.html
  9. 102
      website_hide_button/views/product_templates.xml
  10. 24
      website_hide_button/views/res_config_settings_views.xml
  11. 7
      website_hide_button/views/shop_templates.xml

1
website_hide_button/__init__.py

@ -20,3 +20,4 @@
#
###############################################################################
from . import controllers
from . import models

3
website_hide_button/__manifest__.py

@ -21,7 +21,7 @@
###############################################################################
{
'name': "Hide Price, Add To Cart And Quantity Button In Website",
'version': '17.0.1.0.1',
'version': '17.0.2.0.0',
'category': 'Website',
'summary': """Hide Price, Add To Cart and Quantity button for guest
users""",
@ -36,6 +36,7 @@
'data': [
'views/product_templates.xml',
'views/shop_templates.xml',
'views/res_config_settings_views.xml'
],
'images': ['static/description/banner.jpg'],
'license': 'AGPL-3',

17
website_hide_button/controllers/website_sale.py

@ -40,7 +40,10 @@ class WebsiteSaleInherit(WebsiteSale):
res = super().shop(page, category, search, min_price,
max_price, ppg, **post)
res.qcontext.update({
'login_user': False if request.session.uid is None else True
'login_user': True 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')) else False,
})
return res
@ -50,7 +53,10 @@ class WebsiteSaleInherit(WebsiteSale):
category,
search,
**kwargs)
res['login_user'] = False if request.session.uid is None else True
res['login_user'] = True 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')) else False
return res
@http.route()
@ -58,7 +64,12 @@ class WebsiteSaleInherit(WebsiteSale):
""" Restrict public visitors from accessing payment page so that SO
creation will be disabled """
user = http.request.env.user
if user and user.has_group('base.group_portal') or \
if (
not user._is_public() or user._is_public() and not request.env.user._is_public() and not
request.env[
'ir.config_parameter'].sudo().get_param(
'website_hide_button.hide_cart')) and user.has_group(
'base.group_portal') or \
user.has_group('base.group_user'):
res = super(WebsiteSaleInherit, self).shop_payment(**post)
return res

6
website_hide_button/doc/RELEASE_NOTES.md

@ -3,7 +3,11 @@
#### 06.02.2024
#### Version 17.0.1.0.0
#### ADD
- Initial commit for Hide Price, Add To Cart And Quantity Button In Website
#### 23.09.2024
#### Version 17.0.2.0.0
##### UPDT
- Bug Fix-Added an option in the general settings of the Website module to enable 'Hide Cart for Guests' and 'Hide Product Prices from Guests'.

22
website_hide_button/models/__init__.py

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
################################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Unnimaya C O (odoo@cybrosys.com)
#
# You can modify it under the terms of the GNU AFFERO
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details.
#
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
# (AGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
################################################################################
from . import res_config_settings

61
website_hide_button/models/res_config_settings.py

@ -0,0 +1,61 @@
# -*- coding: utf-8 -*-
################################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Unnimaya C O (odoo@cybrosys.com)
#
# You can modify it under the terms of the GNU AFFERO
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details.
#
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
# (AGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
################################################################################
from odoo import api, fields, models
class ResConfigSettings(models.TransientModel):
"""
Add extra fields in the settings.
"""
_inherit = 'res.config.settings'
hide_price = fields.Boolean(string='Hide Price',
config_parameter='website_hide_button.hide_price',
help="If enabled, the price of product will not be visible to guest users in website")
hide_cart = fields.Boolean(string='Hide Cart',
config_parameter='website_hide_button.hide_cart',
help="If enabled, the Add to Cart button and Cart Icon will be visible to guest users")
def set_values(self):
"""Method for setting the parameters"""
super(ResConfigSettings, self).set_values()
self.env['ir.config_parameter'].sudo().set_param(
'website_hide_button.hide_price', self.hide_price)
self.env['ir.config_parameter'].sudo().set_param(
'website_hide_button.hide_cart', self.hide_cart)
@api.model
def get_smartsupp_details(self):
"""Method for get value"""
hide_price = self.env['ir.config_parameter'].sudo().get_param(
'website_hide_button.hide_price')
hide_cart = self.env['ir.config_parameter'].sudo().get_param(
'website_hide_button.hide_cart')
return {
'hide_price': hide_price,
'hide_cart': hide_cart,
}
@api.onchange('hide_price')
def _onchange_hide_price(self):
if self.hide_price:
self.hide_cart = True

BIN
website_hide_button/static/description/assets/screenshots/0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

431
website_hide_button/static/description/index.html

@ -46,8 +46,10 @@
#1A202C;">
Hide Price, Add To Cart And Quantity Button In Website</h1>
<p class="my-3 mb-4"
style="max-width: 80%; font-weight: 400 !important; line-height: 32px; color: #718096;">This App Allows Only Login Users to View the Price, Add To Cart
Button and Quantity from Website.
style="max-width: 80%; font-weight: 400 !important; line-height: 32px; color: #718096;">
This App Allows Only Login Users to View the Price, Add To
Cart
Button and Quantity from Website.
</p>
<div style="width: 80%; margin-top: 3rem;">
<img src="assets/screenshots/hero.gif"
@ -55,68 +57,75 @@
</div>
</div>
</div>
<div class="container mt-5 mb-5">
<div class="col-lg-12 d-flex flex-column justify-content-center align-items-center mt-4">
<p class="m-0" style="font-weight: 600; font-size: 24px; color:#714b67 !important">
Key Highlights
</p>
</div>
<div class="row py-4">
<div class="col-md-6 col-sm-12 p-3">
<div class="d-flex h-100" style="padding: 30px;border-radius: 12px;
<div class="container mt-5 mb-5">
<div class="col-lg-12 d-flex flex-column justify-content-center align-items-center mt-4">
<p class="m-0"
style="font-weight: 600; font-size: 24px; color:#714b67 !important">
Key Highlights
</p>
</div>
<div class="row py-4">
<div class="col-md-6 col-sm-12 p-3">
<div class="d-flex h-100" style="padding: 30px;border-radius: 12px;
background: #FFF;
box-shadow: 1px 2px 3px 0px rgba(0, 0, 0, 0.25); ">
<div style="width: 36px; height: 36px; border-radius: 50%; background: #714B67;
<div style="width: 36px; height: 36px; border-radius: 50%; background: #714B67;
display: flex; justify-content: center; align-items: center;
margin-right: 10px; flex-shrink: 0;">
<i class="fa-solid fa-star " style="color: #fff;font-size:14px;"></i>
</div>
<div>
<p style="color: #1A202C;font-weight: 600;
font-size: 1.2rem; margin-bottom: 2px;">Hide Price, Add to cart buttons and Quantity of
the product from Guest users. That will be only visible
<i class="fa-solid fa-star "
style="color: #fff;font-size:14px;"></i>
</div>
<div>
<p style="color: #1A202C;font-weight: 600;
font-size: 1.2rem; margin-bottom: 2px;">
Hide Price, Add to cart buttons and Quantity of
the product from Guest users. That will be only
visible
to login users.
</div>
</div>
</div>
</div>
<div class="row py-4">
<div class="col-md-6 col-sm-12 p-3">
<div class="d-flex h-100" style="padding: 30px;border-radius: 12px;
</div>
<div class="row py-4">
<div class="col-md-6 col-sm-12 p-3">
<div class="d-flex h-100" style="padding: 30px;border-radius: 12px;
background: #FFF;
box-shadow: 1px 2px 3px 0px rgba(0, 0, 0, 0.25); ">
<div style="width: 36px; height: 36px; border-radius: 50%; background: #714B67;
<div style="width: 36px; height: 36px; border-radius: 50%; background: #714B67;
display: flex; justify-content: center; align-items: center;
margin-right: 10px; flex-shrink: 0;">
<i class="fa-solid fa-star " style="color: #fff;font-size:14px;"></i>
</div>
<div>
<p style="color: #1A202C;font-weight: 600;
<i class="fa-solid fa-star "
style="color: #fff;font-size:14px;"></i>
</div>
<div>
<p style="color: #1A202C;font-weight: 600;
font-size: 1.2rem; margin-bottom: 2px;">
Hide cart quickview for public users.
</div>
Hide cart quickview for public users.
</div>
</div>
</div>
<div class="row py-4">
<div class="col-md-6 col-sm-12 p-3">
<div class="d-flex h-100" style="padding: 30px;border-radius: 12px;
</div>
<div class="row py-4">
<div class="col-md-6 col-sm-12 p-3">
<div class="d-flex h-100" style="padding: 30px;border-radius: 12px;
background: #FFF;
box-shadow: 1px 2px 3px 0px rgba(0, 0, 0, 0.25); ">
<div style="width: 36px; height: 36px; border-radius: 50%; background: #714B67;
<div style="width: 36px; height: 36px; border-radius: 50%; background: #714B67;
display: flex; justify-content: center; align-items: center;
margin-right: 10px; flex-shrink: 0;">
<i class="fa-solid fa-star " style="color: #fff;font-size:14px;"></i>
</div>
<div>
<p style="color: #1A202C;font-weight: 600;
<i class="fa-solid fa-star "
style="color: #fff;font-size:14px;"></i>
</div>
<div>
<p style="color: #1A202C;font-weight: 600;
font-size: 1.2rem; margin-bottom: 2px;">
Disable the order creation option for public users.
</div>
Disable the order creation option for public
users.
</div>
</div>
</div>
</div>
</div>
<div class="container rounded">
<ul class="nav nav-tabs d-flex"
style="width: fit-content;margin: 0 auto;gap: 1rem;">
@ -146,81 +155,124 @@
<div class="tab-content"
style="background-color: rgba(121, 113, 119, 0.04);">
<div id="tab1" class="tab-pane fade in active show">
<div class="col-lg-12 py-2" style="padding: 1rem 4rem !important;">
<div
<div class="col-lg-12 py-2"
style="padding: 1rem 4rem !important;">
<div
style="border: 1px solid #d8d6d6; border-radius: 4px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<div class="row justify-content-center p-3 w-100 m-0">
<img src="assets/screenshots/1.png" class="img-responsive" width="100%" height="auto">
</div>
<div class="px-3">
<h4 class="mt-2"
style=" font-weight:600 !important; color:#282F33 !important; font-size:1.3rem !important">
Login user can see the product price in Shop page.</h4>
</div>
<div class="row justify-content-center p-3 w-100 m-0">
<img src="assets/screenshots/0.png"
class="img-responsive" width="100%"
height="auto">
</div>
<div class="px-3">
<h4 class="mt-2"
style=" font-weight:600 !important; color:#282F33 !important; font-size:1.3rem !important">
The user can enable the 'Hide Cart for Guests' and 'Hide Product Prices from Guests' options in the general settings of the Website module.</h4>
</div>
</div>
</div>
<div class="col-lg-12 py-2"
style="padding: 1rem 4rem !important;">
<div
style="border: 1px solid #d8d6d6; border-radius: 4px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<div class="row justify-content-center p-3 w-100 m-0">
<img src="assets/screenshots/1.png"
class="img-responsive" width="100%"
height="auto">
</div>
<div class="px-3">
<h4 class="mt-2"
style=" font-weight:600 !important; color:#282F33 !important; font-size:1.3rem !important">
Login user can see the product price in Shop
page.</h4>
</div>
</div>
<div class="col-lg-12 py-2" style="padding: 1rem 4rem !important;">
<div
</div>
<div class="col-lg-12 py-2"
style="padding: 1rem 4rem !important;">
<div
style="border: 1px solid #d8d6d6; border-radius: 4px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<div class="row justify-content-center p-3 w-100 m-0">
<img src="assets/screenshots/2.png" class="img-responsive" width="100%" height="auto">
</div>
<div class="px-3">
<h4 class="mt-2"
style=" font-weight:600 !important; color:#282F33 !important; font-size:1.3rem !important">
Login user can see Product Price, ADD TO CART button and Quantity in Product page.</h4>
</div>
<div class="row justify-content-center p-3 w-100 m-0">
<img src="assets/screenshots/2.png"
class="img-responsive" width="100%"
height="auto">
</div>
<div class="px-3">
<h4 class="mt-2"
style=" font-weight:600 !important; color:#282F33 !important; font-size:1.3rem !important">
Login user can see Product Price, ADD TO
CART button and Quantity in Product
page.</h4>
</div>
</div>
<div class="col-lg-12 py-2" style="padding: 1rem 4rem !important;">
<div
</div>
<div class="col-lg-12 py-2"
style="padding: 1rem 4rem !important;">
<div
style="border: 1px solid #d8d6d6; border-radius: 4px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<div class="row justify-content-center p-3 w-100 m-0">
<img src="assets/screenshots/3.png" class="img-responsive" width="100%" height="auto">
</div>
<div class="px-3">
<h4 class="mt-2"
style=" font-weight:600 !important; color:#282F33 !important; font-size:1.3rem !important">
Product Price is not visible to Guest user in Shop page.</h4>
</div>
<div class="row justify-content-center p-3 w-100 m-0">
<img src="assets/screenshots/4.png" class="img-responsive" width="100%" height="auto">
</div>
<div class="px-3">
<h4 class="mt-2"
style=" font-weight:600 !important; color:#282F33 !important; font-size:1.3rem !important">
Product Price, ADD TO CART button and Quantity are hided for Guest users in Product page.</h4>
</div>
<div class="row justify-content-center p-3 w-100 m-0">
<img src="assets/screenshots/3.png"
class="img-responsive" width="100%"
height="auto">
</div>
<div class="px-3">
<h4 class="mt-2"
style=" font-weight:600 !important; color:#282F33 !important; font-size:1.3rem !important">
Product Price is not visible to Guest user
in Shop page.</h4>
</div>
<div class="row justify-content-center p-3 w-100 m-0">
<img src="assets/screenshots/4.png"
class="img-responsive" width="100%"
height="auto">
</div>
<div class="px-3">
<h4 class="mt-2"
style=" font-weight:600 !important; color:#282F33 !important; font-size:1.3rem !important">
Product Price, ADD TO CART button and
Quantity are hided for Guest users in
Product page.</h4>
</div>
</div>
</div>
</div>
<div id="tab2" class="tab-pane fade">
<div class="col-mg-12" style="padding: 1rem 4rem;">
<ul style="list-style: none; padding: 1rem 0;font-weight: 500;">
<li class="py-3"
style="font-weight: 500;background-color: #fff; border-radius: 4px; padding: 1rem; margin-bottom: 1rem; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<span style="margin-right: 12px;"><img src="assets/misc/star (1) 2.svg" alt=""
width="16px"></span>Hide Price, Add to cart buttons and Quantity of
the product from Guest users. That will be only visible
<div class="col-mg-12" style="padding: 1rem 4rem;">
<ul style="list-style: none; padding: 1rem 0;font-weight: 500;">
<li class="py-3"
style="font-weight: 500;background-color: #fff; border-radius: 4px; padding: 1rem; margin-bottom: 1rem; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<span style="margin-right: 12px;"><img
src="assets/misc/star (1) 2.svg"
alt=""
width="16px"></span>Hide Price, Add
to cart buttons and Quantity of
the product from Guest users. That will be only
visible
to login users.
</li>
</ul>
<ul style="list-style: none; padding: 1rem 0;font-weight: 500;">
<li class="py-3"
style="font-weight: 500;background-color: #fff; border-radius: 4px; padding: 1rem; margin-bottom: 1rem; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<span style="margin-right: 12px;"><img src="assets/misc/star (1) 2.svg" alt=""
width="16px"></span>Hide cart quickview for public users.
</li>
</ul>
<ul style="list-style: none; padding: 1rem 0;font-weight: 500;">
<li class="py-3"
style="font-weight: 500;background-color: #fff; border-radius: 4px; padding: 1rem; margin-bottom: 1rem; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<span style="margin-right: 12px;"><img src="assets/misc/star (1) 2.svg" alt=""
width="16px"></span>Disable the order creation option for public users.
</li>
</ul>
</div>
</li>
</ul>
<ul style="list-style: none; padding: 1rem 0;font-weight: 500;">
<li class="py-3"
style="font-weight: 500;background-color: #fff; border-radius: 4px; padding: 1rem; margin-bottom: 1rem; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<span style="margin-right: 12px;"><img
src="assets/misc/star (1) 2.svg"
alt=""
width="16px"></span>Hide cart
quickview for public users.
</li>
</ul>
<ul style="list-style: none; padding: 1rem 0;font-weight: 500;">
<li class="py-3"
style="font-weight: 500;background-color: #fff; border-radius: 4px; padding: 1rem; margin-bottom: 1rem; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<span style="margin-right: 12px;"><img
src="assets/misc/star (1) 2.svg"
alt=""
width="16px"></span>Disable the
order creation option for public users.
</li>
</ul>
</div>
</div>
<div id="tab3" class="tab-pane fade">
<div class="col-mg-12 active" style="padding: 1rem 4rem;">
<div class="py-3"
@ -233,7 +285,8 @@
</div>
<p class="m-0"
style=" color:#718096!important; font-size:1rem !important;line-height: 28px;">
Initial commit for Hide Price, Add To Cart And Quantity Button In Website.</p>
Initial commit for Hide Price, Add To Cart And
Quantity Button In Website.</p>
</div>
</div>
</div>
@ -246,105 +299,133 @@
Related Products</p>
</div>
</div>
<div id="myCarousel" class="carousel slide py-3" data-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
<div class="row p-4">
<div class="col">
<div class="p-3">
<a href="https://apps.odoo.com/apps/modules/17.0/base_accounting_kit/" style="color: #000; text-decoration: none;">
<div style="border:1px solid #CBCBCB !important;border-radius: 4px;">
<div style="width: 300px; ">
<img src="assets/modules/1.gif" alt="" width="100%" height="auto">
<div id="myCarousel" class="carousel slide py-3" data-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
<div class="row p-4">
<div class="col">
<div class="p-3">
<a href="https://apps.odoo.com/apps/modules/17.0/base_accounting_kit/"
style="color: #000; text-decoration: none;">
<div style="border:1px solid #CBCBCB !important;border-radius: 4px;">
<div style="width: 300px; ">
<img src="assets/modules/1.gif"
alt="" width="100%"
height="auto">
</div>
<p class="text-center pt-2 text-black font-weight-bold">Odoo 17 Full Accounting Kit</p>
</div>
</a>
</div>
<p class="text-center pt-2 text-black font-weight-bold">
Odoo 17 Full Accounting Kit</p>
</div>
</a>
</div>
<div class="col">
<div class="p-3">
<a href="https://apps.odoo.com/apps/modules/17.0/invoice_format_editor/" style="color: #000; text-decoration: none;">
<div style="border:1px solid #CBCBCB !important;border-radius: 4px;">
<div style="width: 300px; ">
<img src="assets/modules/2.png" alt="" width="100%" height="auto">
</div>
<div class="col">
<div class="p-3">
<a href="https://apps.odoo.com/apps/modules/17.0/invoice_format_editor/"
style="color: #000; text-decoration: none;">
<div style="border:1px solid #CBCBCB !important;border-radius: 4px;">
<div style="width: 300px; ">
<img src="assets/modules/2.png"
alt="" width="100%"
height="auto">
</div>
<p class="text-center pt-2 text-black font-weight-bold">Invoice Format Editor</p>
</div>
</a>
</div>
<p class="text-center pt-2 text-black font-weight-bold">
Invoice Format Editor</p>
</div>
</a>
</div>
<div class="col">
<div class="p-3">
<a href="https://apps.odoo.com/apps/modules/17.0/inventory_barcode_scanning/" style="color: #000; text-decoration: none;">
<div style="border:1px solid #CBCBCB !important;border-radius: 4px;">
<div style="width: 300px; ">
<img src="assets/modules/3.png" alt="" width="100%" height="auto">
</div>
<div class="col">
<div class="p-3">
<a href="https://apps.odoo.com/apps/modules/17.0/inventory_barcode_scanning/"
style="color: #000; text-decoration: none;">
<div style="border:1px solid #CBCBCB !important;border-radius: 4px;">
<div style="width: 300px; ">
<img src="assets/modules/3.png"
alt="" width="100%"
height="auto">
</div>
<p class="text-center pt-2 text-black font-weight-bold">Barcode scanning in Inventory</p>
</div>
</a>
</div>
<p class="text-center pt-2 text-black font-weight-bold">
Barcode scanning in Inventory</p>
</div>
</a>
</div>
</div>
</div>
<div class="carousel-item">
<div class="row p-4">
<div class="col">
<div class="p-3">
<a href="https://apps.odoo.com/apps/modules/17.0/whatsapp_redirect/" style="color: #000; text-decoration: none;">
<div style="border:1px solid #CBCBCB !important;border-radius: 4px;">
<div style="width: 300px; ">
<img src="assets/modules/4.jpg" alt="" width="100%" height="auto">
</div>
<div class="carousel-item">
<div class="row p-4">
<div class="col">
<div class="p-3">
<a href="https://apps.odoo.com/apps/modules/17.0/whatsapp_redirect/"
style="color: #000; text-decoration: none;">
<div style="border:1px solid #CBCBCB !important;border-radius: 4px;">
<div style="width: 300px; ">
<img src="assets/modules/4.jpg"
alt="" width="100%"
height="auto">
</div>
<p class="text-center pt-2 text-black font-weight-bold">Send Whatsapp Message</p>
</div>
</a>
</div>
<p class="text-center pt-2 text-black font-weight-bold">
Send Whatsapp Message</p>
</div>
</a>
</div>
<div class="col">
<div class="p-3">
<a href="https://apps.odoo.com/apps/modules/17.0/base_account_budget/" style="color: #000; text-decoration: none;">
<div style="border:1px solid #CBCBCB !important;border-radius: 4px;">
<div style="width: 300px;">
<img src="assets/modules/5.jpg" alt="" width="100%" height="auto">
</div>
<div class="col">
<div class="p-3">
<a href="https://apps.odoo.com/apps/modules/17.0/base_account_budget/"
style="color: #000; text-decoration: none;">
<div style="border:1px solid #CBCBCB !important;border-radius: 4px;">
<div style="width: 300px;">
<img src="assets/modules/5.jpg"
alt="" width="100%"
height="auto">
</div>
<p class="text-center pt-2 text-black font-weight-bold">Budget Management</p>
</div>
</a>
</div>
<p class="text-center pt-2 text-black font-weight-bold">
Budget Management</p>
</div>
</a>
</div>
<div class="col">
<div class="p-3">
<a href="https://apps.odoo.com/apps/modules/17.0/product_barcode/" style="color: #000; text-decoration: none;">
<div style="border:1px solid #CBCBCB !important;border-radius: 4px;">
<div style="width: 300px;">
<img src="assets/modules/6.png" alt="" width="100%" height="auto">
</div>
<p class="text-center pt-2 text-black font-weight-bold">Product Barcode Generator</p>
</div>
<div class="col">
<div class="p-3">
<a href="https://apps.odoo.com/apps/modules/17.0/product_barcode/"
style="color: #000; text-decoration: none;">
<div style="border:1px solid #CBCBCB !important;border-radius: 4px;">
<div style="width: 300px;">
<img src="assets/modules/6.png"
alt="" width="100%"
height="auto">
</div>
</a>
</div>
<p class="text-center pt-2 text-black font-weight-bold">
Product Barcode Generator</p>
</div>
</a>
</div>
</div>
</div>
</div>
<a class="carousel-control-prev" href="#myCarousel" data-slide="prev" style="width: 35px; color: #000;">
</div>
<a class="carousel-control-prev" href="#myCarousel"
data-slide="prev" style="width: 35px; color: #000;">
<span class="carousel-control-prev-icon">
<i class="fa fa-chevron-left" style="font-size: 24px;"></i>
<i class="fa fa-chevron-left"
style="font-size: 24px;"></i>
</span>
</a>
<a class="carousel-control-next" href="#myCarousel" data-slide="next" style="width: 35px; color: #000;">
</a>
<a class="carousel-control-next" href="#myCarousel"
data-slide="next" style="width: 35px; color: #000;">
<span class="carousel-control-next-icon">
<i class="fa fa-chevron-right" style="font-size: 24px;"></i>
<i class="fa fa-chevron-right"
style="font-size: 24px;"></i>
</span>
</a>
</div>
</a>
</div>
<div class="container mt-5">
<div class="col-lg-12 d-flex flex-column justify-content-center align-items-center mt-4">
<p class="m-0"

102
website_hide_button/views/product_templates.xml

@ -1,51 +1,50 @@
<?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="//a[@id='add_to_cart']" position="before">
<div class="alert alert-info" t-if="user_id._is_public()">
<i class="fa fa-info-circle" />
<div class="alert alert-info"
t-if="request.env.user._is_public() and request.env['ir.config_parameter'].sudo().get_param('website_hide_button.hide_cart')">
<i class="fa fa-info-circle"/>
<span>Please Log in to see price and buy options.</span>
</div>
</xpath>
<xpath expr="//a[@id='add_to_cart']" position="attributes">
<attribute name="t-if">
not user_id._is_public()
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='o_wsale_cta_wrapper']" position="attributes">
<attribute name="t-if">login_user == True</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 user_id._is_public()</attribute>
<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_pricet'))
</attribute>
</xpath>
</template>
<!-- Cart_hide -->
<template id="header_cart_link_hide" inherit_id="website_sale.header_cart_link">
<template id="header_cart_link_hide"
inherit_id="website_sale.header_cart_link">
<xpath expr="//t[@t-set='show_cart']" position="replace">
<t t-if="not user_id._is_public()">
<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_cart'))">
<t t-set="show_cart" t-value="true"/>
</t>
<t t-else="">
<t t-set="show_cart" t-value="false"/>
</t>
</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 user_id._is_public()">
<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="">
@ -53,57 +52,82 @@
</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 user_id._is_public()
<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">
<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 user_id._is_public()
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">
<xpath expr="//div[hasclass('o_wsale_product_btn')]"
position="attributes">
<attribute name="t-if">
product.product_variant_ids and not user_id._is_public()
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">
<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 user_id._is_public()
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">
<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 user_id._is_public()</attribute>
<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">
<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 user_id._is_public() and not data['website_hide_price']</attribute>
<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')))
and not data['website_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 user_id._is_public()</attribute>
<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>

24
website_hide_button/views/res_config_settings_views.xml

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Inherited to add extra fields -->
<record id="res_config_settings_view_form" model="ir.ui.view">
<field name="name">
res.config.settings.view.form.inherit.website.hide.button
</field>
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="website.res_config_settings_view_form"/>
<field name="arch" type="xml">
<block id="sale_product_catalog_settings" position="inside">
<setting id="show_price_setting"
string="Hide Product Prices for Guests"
help="Hides product prices from guest users in Website">
<field name="hide_price"/>
</setting>
<setting id="show_cart_setting" string="Hide Cart from Guests"
help="Hide 'Add to Cart' button and Cart quick view for Guest users">
<field name="hide_cart" readonly="hide_price"/>
</setting>
</block>
</field>
</record>
</odoo>

7
website_hide_button/views/shop_templates.xml

@ -3,7 +3,12 @@
<!-- Hide product price for Guest users -->
<template id="products_item" inherit_id="website_sale.products_item">
<xpath expr="//div[hasclass('product_price')]" position="attributes">
<attribute name="t-if">login_user == True</attribute>
<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>

Loading…
Cancel
Save