Skip to content

[17.0][MIG] website_active: Migration to 17.0 #1089

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: 17.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions website_active/README.rst
Original file line number Diff line number Diff line change
@@ -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 <https://github.com/OCA/website/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/website/issues/new?body=module:%20website_active%0Aversion:%2017.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
-------

* Forgeflow

Contributors
------------

- `ForgeFlow <https://www.forgeflow.com/>`__:

- Elmer García <[email protected]>
- Joan Solé <[email protected]>

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 <https://github.com/OCA/website/tree/17.0/website_active>`_ 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_active/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
13 changes: 13 additions & 0 deletions website_active/__manifest__.py
Original file line number Diff line number Diff line change
@@ -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,
}
4 changes: 4 additions & 0 deletions website_active/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright 2023 Forgeflow <http://therp.nl>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import website
21 changes: 21 additions & 0 deletions website_active/models/website.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2015 Therp BV <http://therp.nl>
# 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"] = (

Check warning on line 18 in website_active/models/website.py

View check run for this annotation

Codecov / codecov/patch

website_active/models/website.py#L17-L18

Added lines #L17 - L18 were not covered by tests
self.env["website"].search([], limit=1).id
)
return super().get_current_website(fallback=fallback)
3 changes: 3 additions & 0 deletions website_active/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
3 changes: 3 additions & 0 deletions website_active/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- [ForgeFlow](https://www.forgeflow.com/):
- Elmer García \<<[email protected]>\>
- Joan Solé \<<[email protected]>\>
3 changes: 3 additions & 0 deletions website_active/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -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.
6 changes: 6 additions & 0 deletions website_active/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -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
Loading