diff --git a/website_active/README.rst b/website_active/README.rst new file mode 100644 index 0000000000..0edbe3c523 --- /dev/null +++ b/website_active/README.rst @@ -0,0 +1,91 @@ +============== +Website Active +============== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:7727cc8e85c462e52ac064ff584321fccac5c907f7cc8b125a678f21697940c0 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Fwebsite-lightgray.png?logo=github + :target: https://github.com/OCA/website/tree/17.0/website_active + :alt: OCA/website +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/website-17-0/website-17-0-website_active + :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/website&target_branch=17.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module enables the functionality to archive a website in Odoo so +that by default, the other website, if there is more than one, becomes +active. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +To use this module, you need to: + +1. Go to Settings > General Settings +2. Activate the developer mode +3. Go to Website > Configuration > Websites +4. Select a website > Action > Archive + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Forgeflow + +Contributors +------------ + +- `ForgeFlow `__: + + - Elmer García + - Joan Solé + +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/website `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/website_active/__init__.py b/website_active/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/website_active/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/website_active/__manifest__.py b/website_active/__manifest__.py new file mode 100644 index 0000000000..8180eb057b --- /dev/null +++ b/website_active/__manifest__.py @@ -0,0 +1,13 @@ +{ + "name": "Website Active", + "version": "17.0.1.0.0", + "author": "Forgeflow, Odoo Community Association (OCA)", + "license": "AGPL-3", + "category": "Website", + "summary": "Enable to archive websites", + "website": "https://github.com/OCA/website", + "depends": [ + "website", + ], + "installable": True, +} diff --git a/website_active/models/__init__.py b/website_active/models/__init__.py new file mode 100644 index 0000000000..7f624f1565 --- /dev/null +++ b/website_active/models/__init__.py @@ -0,0 +1,4 @@ +# Copyright 2023 Forgeflow +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from . import website diff --git a/website_active/models/website.py b/website_active/models/website.py new file mode 100644 index 0000000000..04ce4b9cee --- /dev/null +++ b/website_active/models/website.py @@ -0,0 +1,21 @@ +# Copyright 2015 Therp BV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo import api, fields, models +from odoo.http import request + + +class Website(models.Model): + _inherit = "website" + + active = fields.Boolean(default=True) + + @api.model + def get_current_website(self, fallback=True): + if request and request.session.get("force_website_id"): + website_id = self.browse(request.session["force_website_id"]).exists() + if website_id and not website_id.active: + request.session.pop("force_website_id") + request.session["force_website_id"] = ( + self.env["website"].search([], limit=1).id + ) + return super().get_current_website(fallback=fallback) diff --git a/website_active/pyproject.toml b/website_active/pyproject.toml new file mode 100644 index 0000000000..4231d0cccb --- /dev/null +++ b/website_active/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/website_active/readme/CONTRIBUTORS.md b/website_active/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..34e56bedd8 --- /dev/null +++ b/website_active/readme/CONTRIBUTORS.md @@ -0,0 +1,3 @@ +- [ForgeFlow](https://www.forgeflow.com/): + - Elmer García \<\> + - Joan Solé \<\> diff --git a/website_active/readme/DESCRIPTION.md b/website_active/readme/DESCRIPTION.md new file mode 100644 index 0000000000..8df514e1d3 --- /dev/null +++ b/website_active/readme/DESCRIPTION.md @@ -0,0 +1,3 @@ +This module enables the functionality to archive a website in Odoo so +that by default, the other website, if there is more than one, becomes +active. diff --git a/website_active/readme/USAGE.md b/website_active/readme/USAGE.md new file mode 100644 index 0000000000..959db21194 --- /dev/null +++ b/website_active/readme/USAGE.md @@ -0,0 +1,6 @@ +To use this module, you need to: + +1. Go to Settings \> General Settings +2. Activate the developer mode +3. Go to Website \> Configuration \> Websites +4. Select a website \> Action \> Archive diff --git a/website_active/static/description/index.html b/website_active/static/description/index.html new file mode 100644 index 0000000000..1975a442e3 --- /dev/null +++ b/website_active/static/description/index.html @@ -0,0 +1,440 @@ + + + + + +Website Active + + + +
+

Website Active

+ + +

Beta License: AGPL-3 OCA/website Translate me on Weblate Try me on Runboat

+

This module enables the functionality to archive a website in Odoo so +that by default, the other website, if there is more than one, becomes +active.

+

Table of contents

+ +
+

Usage

+

To use this module, you need to:

+
    +
  1. Go to Settings > General Settings
  2. +
  3. Activate the developer mode
  4. +
  5. Go to Website > Configuration > Websites
  6. +
  7. Select a website > Action > Archive
  8. +
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub 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.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Forgeflow
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

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/website project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ +