From c3b1ca93419f3a8c4d12397a81c6d9cd38dbab78 Mon Sep 17 00:00:00 2001 From: RisvanaCybro Date: Thu, 30 Nov 2023 12:16:58 +0530 Subject: [PATCH] Nov 30 : [UPDT] Feature Updated 'website_hide_button' --- website_hide_button/__manifest__.py | 5 - .../controllers/website_sale.py | 26 ++++- website_hide_button/doc/RELEASE_NOTES.md | 6 ++ .../static/description/index.html | 13 +++ .../static/src/css/product_details.css | 3 - .../views/product_templates.xml | 102 +++++++++++++++++- website_hide_button/views/shop_templates.xml | 2 +- 7 files changed, 139 insertions(+), 18 deletions(-) delete mode 100644 website_hide_button/static/src/css/product_details.css diff --git a/website_hide_button/__manifest__.py b/website_hide_button/__manifest__.py index 2f1e84601..305f4f437 100644 --- a/website_hide_button/__manifest__.py +++ b/website_hide_button/__manifest__.py @@ -37,11 +37,6 @@ 'views/product_templates.xml', 'views/shop_templates.xml', ], - 'assets': { - 'web.assets_frontend': [ - 'website_hide_button/static/src/css/product_details.css' - ] - }, 'images': ['static/description/banner.jpg'], 'license': 'AGPL-3', 'installable': True, diff --git a/website_hide_button/controllers/website_sale.py b/website_hide_button/controllers/website_sale.py index adb1651ad..15f8f6e4c 100644 --- a/website_hide_button/controllers/website_sale.py +++ b/website_hide_button/controllers/website_sale.py @@ -27,11 +27,18 @@ from odoo.addons.website_sale.controllers.main import WebsiteSale class WebsiteSaleInherit(WebsiteSale): """class to hide price, add to cart and quantity""" + @http.route([ + '''/shop''', + '''/shop/page/''', + '''/shop/category/''', + '''/shop/category// + page/''' + ], type='http', auth="public", website=True) def shop(self, page=0, category=None, search='', min_price=0.0, max_price=0.0, ppg=False, **post): """Method for finding log in user or not in shop page """ - res = super().shop(page, category, search, min_price, - max_price, ppg, **post) + res = super().shop(page=0, category=None, search='', min_price=0.0, + max_price=0.0, ppg=False, **post) res.qcontext.update({ 'login_user': False if request.session.uid is None else True }) @@ -43,7 +50,16 @@ class WebsiteSaleInherit(WebsiteSale): category, search, **kwargs) - res.update({ - 'login_user': False if request.session.uid is None else True - }) + res['login_user'] = False if request.session.uid is None else True return res + + @http.route() + def shop_payment(self, **post): + """ 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 \ + user.has_group('base.group_user'): + res = super(WebsiteSaleInherit, self).shop_payment(**post) + return res + return request.redirect("/") diff --git a/website_hide_button/doc/RELEASE_NOTES.md b/website_hide_button/doc/RELEASE_NOTES.md index a367ccd18..d0d625480 100644 --- a/website_hide_button/doc/RELEASE_NOTES.md +++ b/website_hide_button/doc/RELEASE_NOTES.md @@ -5,3 +5,9 @@ #### ADD - Initial commit for Hide Price, Add To Cart And Quantity Button In Website + +#### 24.11.2023 +#### Version 16.0.1.0.1 +#### UPDATE + +- Merged features from website_sale_price_hide v16.0.1.0.0 diff --git a/website_hide_button/static/description/index.html b/website_hide_button/static/description/index.html index 0a43dd537..831d60a6c 100644 --- a/website_hide_button/static/description/index.html +++ b/website_hide_button/static/description/index.html @@ -105,6 +105,7 @@ button. But these features will be hidden for guest users. +
+
+ + + Hide cart quickview for public users. + +
+
+ + + Disable the order creation option for public users. + +
diff --git a/website_hide_button/static/src/css/product_details.css b/website_hide_button/static/src/css/product_details.css deleted file mode 100644 index 1a94ed05f..000000000 --- a/website_hide_button/static/src/css/product_details.css +++ /dev/null @@ -1,3 +0,0 @@ -.button_remove{ - display: none !important; -} \ No newline at end of file diff --git a/website_hide_button/views/product_templates.xml b/website_hide_button/views/product_templates.xml index 98fb89a94..e9345b51c 100644 --- a/website_hide_button/views/product_templates.xml +++ b/website_hide_button/views/product_templates.xml @@ -1,15 +1,109 @@ + + + + - -