Maintainers
+Maintainers
This module is maintained by the OCA.
@@ -445,6 +457,5 @@ diff --git a/web_theme_classic/README.rst b/web_theme_classic/README.rst index fd43959b27c1..e499fb66dfbb 100644 --- a/web_theme_classic/README.rst +++ b/web_theme_classic/README.rst @@ -1,7 +1,3 @@ -.. image:: https://odoo-community.org/readme-banner-image - :target: https://odoo-community.org/get-involved?utm_source=readme - :alt: Odoo Community Association - ================= Web Theme Classic ================= @@ -17,7 +13,7 @@ Web Theme Classic .. |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/license-AGPL--3-blue.png +.. |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%2Fweb-lightgray.png?logo=github @@ -32,15 +28,15 @@ Web Theme Classic |badge1| |badge2| |badge3| |badge4| |badge5| -This module extend the Odoo Community Edition ``web`` module to improve -visibility of form view. +This module extends the Odoo Community Edition ``web`` module to improve +the visibility of input fields. **Rational:** Since Odoo V17, the design is very pure. That's great, but it generates some problem for users : -- Fields are not identifiable. (we can not know exactly where there are +- Fields are not identifiable. (we can not know exactly where they are until you hover over them with the cursor) -- there is no indication for the required fields until trying to save +- There is no indication for the required fields until trying to save (or exit the screen) In a way, this module restores the form display of version 15, but @@ -62,6 +58,24 @@ preserving the "save on the fly" new feature. .. contents:: :local: +Configuration +============= + +This module allows each user to choose whether they would like input +fields to be displayed the "classic" way or the new, standard way (as if +this module were not installed) + +To do this you can either: + +- Check "Classic Theme Persistent" in user preferences. This will enable + the classic theme for that user across all devices. +- Check the "Classic Theme" toggle in the popover menu triggered bu + clicking on the user icon in the navbar. This toggle is only visible + when "Classic Theme Persistent" is disabled. + +Please note that when disabling "Classic Theme Persistent" the style +will not change until the page is reloaded. + Bug Tracker =========== diff --git a/web_theme_classic/__init__.py b/web_theme_classic/__init__.py index e69de29bb2d1..0650744f6bc6 100644 --- a/web_theme_classic/__init__.py +++ b/web_theme_classic/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/web_theme_classic/__manifest__.py b/web_theme_classic/__manifest__.py index 3a44b3e23790..13568120a799 100644 --- a/web_theme_classic/__manifest__.py +++ b/web_theme_classic/__manifest__.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 - Today: GRAP (http://www.grap.coop) # @author: Sylvain LE GAL (https://twitter.com/legalsylvain) +# © 2025 Liam Noonan - Pyxiris # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { @@ -14,8 +15,14 @@ "depends": [ "web", ], + "data": [ + "views/res_users_views.xml", + ], "assets": { "web.assets_backend": [ + "web_theme_classic/static/src/js/switch_theme.esm.js", + ], + "web.assets_web": [ "/web_theme_classic/static/src/scss/web_theme_classic.scss", ], "web.assets_web_dark": [ diff --git a/web_theme_classic/models/__init__.py b/web_theme_classic/models/__init__.py new file mode 100644 index 000000000000..604d2da2838e --- /dev/null +++ b/web_theme_classic/models/__init__.py @@ -0,0 +1 @@ +from . import ir_http, res_users, res_users_settings diff --git a/web_theme_classic/models/ir_http.py b/web_theme_classic/models/ir_http.py new file mode 100644 index 000000000000..57c4b72eb901 --- /dev/null +++ b/web_theme_classic/models/ir_http.py @@ -0,0 +1,28 @@ +# © 2022 Florian Kantelberg - initOS GmbH +# © 2025 Liam Noonan - Pyxiris +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import models +from odoo.http import request + + +class IrHttp(models.AbstractModel): + _inherit = "ir.http" + + @classmethod + def _set_classic_theme(cls, response): + user = request.env.user + if user and user._is_internal(): + existing_transient_theme = request.httprequest.cookies.get( + "transient_classic_theme_cookie" + ) + persistent_theme = getattr(user, "persistent_classic_theme", None) + # Delete the cookie so that when persistent gets turned off the user + # will not be left wondering why nothing changed + if persistent_theme and existing_transient_theme: + response.delete_cookie("transient_classic_theme_cookie") + + @classmethod + def _post_dispatch(cls, response): + cls._set_classic_theme(response) + return super()._post_dispatch(response) diff --git a/web_theme_classic/models/res_users.py b/web_theme_classic/models/res_users.py new file mode 100644 index 000000000000..f6c4683e4c58 --- /dev/null +++ b/web_theme_classic/models/res_users.py @@ -0,0 +1,31 @@ +# © 2022 Florian Kantelberg - initOS GmbH +# © 2025 Liam Noonan - Pyxiris +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class ResUsers(models.Model): + _inherit = "res.users" + + persistent_classic_theme = fields.Boolean( + related="res_users_settings_id.persistent_classic_theme", + readonly=False, + string="Classic Theme Persistent", + help="This enables Classic Theme on this user's account across all devices. \n " + "Disabling it will will alow you to to use the toggle in the user burger menu " + "in the navbar to enable Classic Mode on a specific session/device \n" + "The toggle is not visible while Persistent Classic Theme is enabled", + ) + + @property + def SELF_READABLE_FIELDS(self): + return super().SELF_READABLE_FIELDS + [ + "persistent_classic_theme", + ] + + @property + def SELF_WRITEABLE_FIELDS(self): + return super().SELF_WRITEABLE_FIELDS + [ + "persistent_classic_theme", + ] diff --git a/web_theme_classic/models/res_users_settings.py b/web_theme_classic/models/res_users_settings.py new file mode 100644 index 000000000000..99b5fe33fdf0 --- /dev/null +++ b/web_theme_classic/models/res_users_settings.py @@ -0,0 +1,12 @@ +# © 2026 Liam Noonan - Pyxiris +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class ResUsersSettings(models.Model): + _inherit = "res.users.settings" + + # These fields should be here in order to be accessible via in js + # as user.settings.persistent_classic_theme + persistent_classic_theme = fields.Boolean(default=True) diff --git a/web_theme_classic/readme/CONFIGURE.md b/web_theme_classic/readme/CONFIGURE.md new file mode 100644 index 000000000000..2824ab8c8952 --- /dev/null +++ b/web_theme_classic/readme/CONFIGURE.md @@ -0,0 +1,7 @@ +This module allows each user to choose whether they would like input fields to be displayed the "classic" way or the new, standard way (as if this module were not installed) + +To do this you can either: ++ Check "Classic Theme Persistent" in user preferences. This will enable the classic theme for that user across all devices. ++ Check the "Classic Theme" toggle in the popover menu triggered bu clicking on the user icon in the navbar. This toggle is only visible when "Classic Theme Persistent" is disabled. + +Please note that when disabling "Classic Theme Persistent" the style will not change until the page is reloaded. diff --git a/web_theme_classic/readme/DESCRIPTION.md b/web_theme_classic/readme/DESCRIPTION.md index afc3f096e0c9..289a33630b07 100644 --- a/web_theme_classic/readme/DESCRIPTION.md +++ b/web_theme_classic/readme/DESCRIPTION.md @@ -1,12 +1,12 @@ -This module extend the Odoo Community Edition `web` module to improve -visibility of form view. +This module extends the Odoo Community Edition `web` module to improve +the visibility of input fields. **Rational:** Since Odoo V17, the design is very pure. That's great, but it generates some problem for users : - Fields are not identifiable. (we can not know exactly - where there are until you hover over them with the cursor) -- there is no indication for the required fields until trying to save + where they are until you hover over them with the cursor) +- There is no indication for the required fields until trying to save (or exit the screen) In a way, this module restores the form display of version 15, but diff --git a/web_theme_classic/static/description/index.html b/web_theme_classic/static/description/index.html index ecd35f6a0d6a..887dd65fcebe 100644 --- a/web_theme_classic/static/description/index.html +++ b/web_theme_classic/static/description/index.html @@ -3,7 +3,7 @@
-This module extend the Odoo Community Edition web module to improve -visibility of form view.
+ +This module extends the Odoo Community Edition web module to improve +the visibility of input fields.
Rational: Since Odoo V17, the design is very pure. That’s great, but it generates some problem for users :
In a way, this module restores the form display of version 15, but @@ -394,17 +389,34 @@
Table of contents
This module allows each user to choose whether they would like input +fields to be displayed the “classic” way or the new, standard way (as if +this module were not installed)
+To do this you can either:
+Please note that when disabling “Classic Theme Persistent” the style +will not change until the page is reloaded.
+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 @@ -412,15 +424,15 @@
Do not contact contributors directly about support or help with technical issues.