Skip to content

Commit

Permalink
[ADD] website_sale_browse_mode
Browse files Browse the repository at this point in the history
  • Loading branch information
victor-champonnois committed Jan 29, 2025
1 parent 860bbfb commit 4c3ddf1
Show file tree
Hide file tree
Showing 15 changed files with 649 additions and 0 deletions.
6 changes: 6 additions & 0 deletions setup/website_sale_browse_mode/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
80 changes: 80 additions & 0 deletions website_sale_browse_mode/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
========================
Website Sale Browse Mode
========================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:e2a8a2bd20985ff73fba3ef9548bdf539500913340f56674331b83490c96b1fb
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fe--commerce-lightgray.png?logo=github
:target: https://github.com/OCA/e-commerce/tree/16.0/website_sale_browse_mode
:alt: OCA/e-commerce
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/e-commerce-16-0/e-commerce-16-0-website_sale_browse_mode
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/e-commerce&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

Show the shop products but disable shopping.
This module is useful for wholesale company taking orders from their clients at specific window of time in the week. They can set the website in browse mode outside these time windows.
The solution chosen is to remove the "add to cart" button rather than to prevent access to the whole shop, which would be more complicated technically.

**Table of contents**

.. contents::
:local:

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/e-commerce/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/e-commerce/issues/new?body=module:%20website_sale_browse_mode%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* Coop IT Easy SC

Contributors
~~~~~~~~~~~~

* `Coop IT Easy SC <https://coopiteasy.be>`_:

* Victor Champonnois

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/e-commerce <https://github.com/OCA/e-commerce/tree/16.0/website_sale_browse_mode>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions website_sale_browse_mode/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
15 changes: 15 additions & 0 deletions website_sale_browse_mode/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "Website Sale Browse Mode",
"version": "16.0.1.0.0",
"category": "Website",
"author": "Coop IT Easy SC, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/e-commerce",
"license": "AGPL-3",
"depends": ["website_sale_stock"],
"data": [
"views/website.xml",
"views/res_config_settings.xml",
"views/website_sale_template.xml",
],
"installable": True,
}
3 changes: 3 additions & 0 deletions website_sale_browse_mode/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from . import product_template
from . import res_config_settings
from . import website
9 changes: 9 additions & 0 deletions website_sale_browse_mode/models/product_template.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from odoo import models


class ProductTemplate(models.Model):
_inherit = "product.template"

def _website_show_quick_add(self):
website = self.env["website"].get_current_website()
return not website.enable_browse_mode and super()._website_show_quick_add()
16 changes: 16 additions & 0 deletions website_sale_browse_mode/models/res_config_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2019-Today Coop IT Easy SC
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import fields, models


class ResConfigSettings(models.TransientModel):

_inherit = "res.config.settings"

enable_browse_mode = fields.Boolean(
help="When checked, users can no longer buy products from the webshop."
"They can only browse the shop and see the products",
related="website_id.enable_browse_mode",
readonly=False,
)
15 changes: 15 additions & 0 deletions website_sale_browse_mode/models/website.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2019-Today Coop IT Easy SC
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import fields, models


class Website(models.Model):

_inherit = "website"

enable_browse_mode = fields.Boolean(
default=False,
help="When checked, users can no longer buy products from the webshop."
"They can only browse the shop and see the products",
)
3 changes: 3 additions & 0 deletions website_sale_browse_mode/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* `Coop IT Easy SC <https://coopiteasy.be>`_:

* Victor Champonnois
3 changes: 3 additions & 0 deletions website_sale_browse_mode/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Show the shop products but disable shopping.
This module is useful for wholesale company taking orders from their clients at specific window of time in the week. They can set the website in browse mode outside these time windows.
The solution chosen is to remove the "add to cart" button rather than to prevent access to the whole shop, which would be more complicated technically.
Loading

0 comments on commit 4c3ddf1

Please sign in to comment.