diff --git a/README.md b/README.md index 0efce8e5d7ca..1e2b05cb8955 100644 --- a/README.md +++ b/README.md @@ -38,11 +38,13 @@ addon | version | maintainers | summary [web_m2x_options_manager](web_m2x_options_manager/) | 19.0.1.0.0 | | Adds an interface to manage the "Create" and "Create and Edit" options for specific models and fields. [web_no_bubble](web_no_bubble/) | 19.0.1.0.0 | | Remove the bubbles from the web interface [web_notify](web_notify/) | 19.0.1.0.1 | | Send notification messages to user +[web_notify_upgrade](web_notify_upgrade/) | 19.0.1.0.0 | | Notify active users when a module is installed or updated [web_pwa_customize](web_pwa_customize/) | 19.0.1.0.0 | victoralmau | Web Pwa Customize [web_quick_start_screen](web_quick_start_screen/) | 19.0.1.0.0 | | Configurable start screen for quick actions [web_refresher](web_refresher/) | 19.0.1.0.0 | | Web Refresher [web_remember_tree_column_width](web_remember_tree_column_width/) | 19.0.1.0.0 | frahikLV luisg123v cuongnmtm | Remember the tree columns' widths across sessions. [web_responsive](web_responsive/) | 19.0.1.1.0 | Tardo SplashS | Responsive web client, community-supported +[web_search_deactivate_autosearch](web_search_deactivate_autosearch/) | 19.0.1.0.0 | samirGuesmi AnizR | Allow user to deactivate autosearch to add multiple filters [web_search_with_and](web_search_with_and/) | 19.0.1.0.0 | | Use AND conditions on omnibar search [web_timeline](web_timeline/) | 19.0.1.0.0 | | Interactive visualization chart to show events in time [web_tree_many2one_clickable](web_tree_many2one_clickable/) | 19.0.1.0.0 | | Open the linked resource when clicking on their name diff --git a/setup/_metapackage/pyproject.toml b/setup/_metapackage/pyproject.toml index 93d786869a93..3b235044c2f0 100644 --- a/setup/_metapackage/pyproject.toml +++ b/setup/_metapackage/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "odoo-addons-oca-web" -version = "19.0.20260907.0" +version = "19.0.20260922.0" dependencies = [ "odoo-addon-web_calendar_slot_duration==19.0.*", "odoo-addon-web_chatter_position==19.0.*", @@ -19,11 +19,13 @@ dependencies = [ "odoo-addon-web_m2x_options_manager==19.0.*", "odoo-addon-web_no_bubble==19.0.*", "odoo-addon-web_notify==19.0.*", + "odoo-addon-web_notify_upgrade==19.0.*", "odoo-addon-web_pwa_customize==19.0.*", "odoo-addon-web_quick_start_screen==19.0.*", "odoo-addon-web_refresher==19.0.*", "odoo-addon-web_remember_tree_column_width==19.0.*", "odoo-addon-web_responsive==19.0.*", + "odoo-addon-web_search_deactivate_autosearch==19.0.*", "odoo-addon-web_search_with_and==19.0.*", "odoo-addon-web_timeline==19.0.*", "odoo-addon-web_tree_many2one_clickable==19.0.*", diff --git a/web_notify_upgrade/README.rst b/web_notify_upgrade/README.rst new file mode 100644 index 000000000000..eb1aafc7565a --- /dev/null +++ b/web_notify_upgrade/README.rst @@ -0,0 +1,90 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + +================== +Web Notify Upgrade +================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:5777a86527e7775fedbf066fb9dd07c9b2fd3c0b7604448614c99ecef1a953a2 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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 + :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 + :target: https://github.com/OCA/web/tree/19.0/web_notify_upgrade + :alt: OCA/web +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/web-19-0/web-19-0-web_notify_upgrade + :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/web&target_branch=19.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module uses web_notify send a notification to every active users +whenever a module has been installed or upgraded. + +The notification will ask the user to refresh the page to get the latest +changes. + +|image1| + +.. |image1| image:: https://raw.githubusercontent.com/OCA/web/19.0/web_notify_upgrade/static/description/notify.png + +**Table of contents** + +.. contents:: + :local: + +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 +------- + +* Akretion + +Contributors +------------ + +- `Akretion `__: + + - Florian Mounier + +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/web `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/web_notify_upgrade/__init__.py b/web_notify_upgrade/__init__.py new file mode 100644 index 000000000000..0650744f6bc6 --- /dev/null +++ b/web_notify_upgrade/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/web_notify_upgrade/__manifest__.py b/web_notify_upgrade/__manifest__.py new file mode 100644 index 000000000000..2d393a049f33 --- /dev/null +++ b/web_notify_upgrade/__manifest__.py @@ -0,0 +1,14 @@ +# Copyright 2024 Akretion (http://www.akretion.com). +# @author Florian Mounier +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Web Notify Upgrade", + "summary": "Notify active users when a module is installed or updated", + "version": "19.0.1.0.0", + "license": "AGPL-3", + "depends": ["web_notify"], + "author": "Akretion, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/web", + "installable": True, +} diff --git a/web_notify_upgrade/i18n/fr.po b/web_notify_upgrade/i18n/fr.po new file mode 100644 index 000000000000..b262d01acac9 --- /dev/null +++ b/web_notify_upgrade/i18n/fr.po @@ -0,0 +1,44 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_notify_upgrade +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: \n" +"PO-Revision-Date: 2024-08-14 16:58+0000\n" +"Last-Translator: David Beal \n" +"Language-Team: \n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 5.6.2\n" + +#. module: web_notify_upgrade +#: model:ir.model,name:web_notify_upgrade.model_ir_model_data +msgid "Model Data" +msgstr "Model Data" + +#. module: web_notify_upgrade +#. odoo-python +#: code:addons/web_notify_upgrade/models/ir_model.py:0 +#, python-format +msgid "Reload" +msgstr "Recharger" + +#. module: web_notify_upgrade +#. odoo-python +#: code:addons/web_notify_upgrade/models/ir_model.py:0 +#, python-format +msgid "Upgrade Notification" +msgstr "Notification de mise à jour" + +#. module: web_notify_upgrade +#. odoo-python +#: code:addons/web_notify_upgrade/models/ir_model.py:0 +#, python-format +msgid "Your odoo instance has been upgraded, please reload the web page." +msgstr "Votre instance odoo a été mise à jour, merci de recharger la page web." diff --git a/web_notify_upgrade/i18n/it.po b/web_notify_upgrade/i18n/it.po new file mode 100644 index 000000000000..9eca29655e4a --- /dev/null +++ b/web_notify_upgrade/i18n/it.po @@ -0,0 +1,43 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_notify_upgrade +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-08-12 08:58+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 5.6.2\n" + +#. module: web_notify_upgrade +#: model:ir.model,name:web_notify_upgrade.model_ir_model_data +msgid "Model Data" +msgstr "Dati modello" + +#. module: web_notify_upgrade +#. odoo-python +#: code:addons/web_notify_upgrade/models/ir_model.py:0 +#, python-format +msgid "Reload" +msgstr "Ricarica" + +#. module: web_notify_upgrade +#. odoo-python +#: code:addons/web_notify_upgrade/models/ir_model.py:0 +#, python-format +msgid "Upgrade Notification" +msgstr "Aggiorna notifiche" + +#. module: web_notify_upgrade +#. odoo-python +#: code:addons/web_notify_upgrade/models/ir_model.py:0 +#, python-format +msgid "Your odoo instance has been upgraded, please reload the web page." +msgstr "L'istanza Odoo è stata aggiornata, ricaricare la pagina web." diff --git a/web_notify_upgrade/i18n/sl.po b/web_notify_upgrade/i18n/sl.po new file mode 100644 index 000000000000..f2db0f7dc01e --- /dev/null +++ b/web_notify_upgrade/i18n/sl.po @@ -0,0 +1,42 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_notify_upgrade +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2026-06-06 12:01+0000\n" +"Last-Translator: Matjaz Mozetic \n" +"Language-Team: none\n" +"Language: sl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=4; plural=n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || " +"n%100==4 ? 2 : 3;\n" +"X-Generator: Weblate 5.15.2\n" + +#. module: web_notify_upgrade +#: model:ir.model,name:web_notify_upgrade.model_ir_model_data +msgid "Model Data" +msgstr "Podatki modela" + +#. module: web_notify_upgrade +#. odoo-python +#: code:addons/web_notify_upgrade/models/ir_model.py:0 +msgid "Reload" +msgstr "Ponovno naloži" + +#. module: web_notify_upgrade +#. odoo-python +#: code:addons/web_notify_upgrade/models/ir_model.py:0 +msgid "Upgrade Notification" +msgstr "Obvestilo o nadgradnji" + +#. module: web_notify_upgrade +#. odoo-python +#: code:addons/web_notify_upgrade/models/ir_model.py:0 +msgid "Your odoo instance has been upgraded, please reload the web page." +msgstr "" +"Vaša instanca Odoo je bila posodobljena, prosimo, osvežite spletno stran." diff --git a/web_notify_upgrade/i18n/web_notify_upgrade.pot b/web_notify_upgrade/i18n/web_notify_upgrade.pot new file mode 100644 index 000000000000..fa3c22c18b5f --- /dev/null +++ b/web_notify_upgrade/i18n/web_notify_upgrade.pot @@ -0,0 +1,47 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_notify_upgrade +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 19.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: web_notify_upgrade +#: model:ir.model.fields,field_description:web_notify_upgrade.field_ir_model_data__display_name +msgid "Display Name" +msgstr "" + +#. module: web_notify_upgrade +#: model:ir.model.fields,field_description:web_notify_upgrade.field_ir_model_data__id +msgid "ID" +msgstr "" + +#. module: web_notify_upgrade +#: model:ir.model,name:web_notify_upgrade.model_ir_model_data +msgid "Model Data" +msgstr "" + +#. module: web_notify_upgrade +#. odoo-python +#: code:addons/web_notify_upgrade/models/ir_model.py:0 +msgid "Reload" +msgstr "" + +#. module: web_notify_upgrade +#. odoo-python +#: code:addons/web_notify_upgrade/models/ir_model.py:0 +msgid "Upgrade Notification" +msgstr "" + +#. module: web_notify_upgrade +#. odoo-python +#: code:addons/web_notify_upgrade/models/ir_model.py:0 +msgid "Your odoo instance has been upgraded, please reload the web page." +msgstr "" diff --git a/web_notify_upgrade/models/__init__.py b/web_notify_upgrade/models/__init__.py new file mode 100644 index 000000000000..413bb2380140 --- /dev/null +++ b/web_notify_upgrade/models/__init__.py @@ -0,0 +1 @@ +from . import ir_model diff --git a/web_notify_upgrade/models/ir_model.py b/web_notify_upgrade/models/ir_model.py new file mode 100644 index 000000000000..f975223a377a --- /dev/null +++ b/web_notify_upgrade/models/ir_model.py @@ -0,0 +1,70 @@ +# Copyright 2024 Akretion (http://www.akretion.com). +# @author Florian Mounier +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +import logging + +from odoo import api, models + +from odoo.addons.mail.models.mail_presence import AWAY_TIMER, DISCONNECTION_TIMER + +_logger = logging.getLogger(__name__) + + +class IrModelData(models.Model): + _inherit = "ir.model.data" + + @api.model + def _process_end(self, modules): + # This function is called at the end of the module installation + # only if at least a module has been installed or updated. + rv = super()._process_end(modules) + self._notify_active_users_of_upgrade() + return rv + + def _notify_active_users_of_upgrade(self): + # Look for active users + active_users = self._get_active_users_to_notify_of_upgrade() + if active_users: + _logger.info( + "Installation detected. Notifying %s active users", len(active_users) + ) + # Notify them + active_users.notify_info(**self._get_upgrade_notification_params()) + + def _get_active_users_to_notify_of_upgrade(self): + """Return the active users that should be notified of the upgrade.""" + self.env.cr.execute( + """ + SELECT user_id + FROM mail_presence + WHERE last_poll is not null + AND ( + age(now() AT TIME ZONE 'UTC', last_poll) < interval %s + OR age(now() AT TIME ZONE 'UTC', last_presence) < interval %s + ) + """, + (f"{DISCONNECTION_TIMER} seconds", f"{AWAY_TIMER} seconds"), + ) + return self.env["res.users"].browse([res[0] for res in self.env.cr.fetchall()]) + + def _get_upgrade_notification_params(self): + """Return the parameters to pass to the notify_info method.""" + action = { + "type": "ir.actions.client", + "tag": "reload", + "context": { + "params": { + "button_name": self.env._("Reload"), + "button_icon": "fa-refresh", + } + }, + } + + return { + "message": self.env._( + "Your odoo instance has been upgraded, please reload the web page." + ), + "action": action, + "title": self.env._("Upgrade Notification"), + "sticky": True, + } diff --git a/web_notify_upgrade/pyproject.toml b/web_notify_upgrade/pyproject.toml new file mode 100644 index 000000000000..4231d0cccb3d --- /dev/null +++ b/web_notify_upgrade/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/web_notify_upgrade/readme/CONTRIBUTORS.md b/web_notify_upgrade/readme/CONTRIBUTORS.md new file mode 100644 index 000000000000..3b52e04e621e --- /dev/null +++ b/web_notify_upgrade/readme/CONTRIBUTORS.md @@ -0,0 +1,2 @@ +- [Akretion](https://www.akretion.com): + - Florian Mounier diff --git a/web_notify_upgrade/readme/DESCRIPTION.md b/web_notify_upgrade/readme/DESCRIPTION.md new file mode 100644 index 000000000000..1e3a0476e3e7 --- /dev/null +++ b/web_notify_upgrade/readme/DESCRIPTION.md @@ -0,0 +1,7 @@ +This module uses web_notify send a notification to every active users +whenever a module has been installed or upgraded. + +The notification will ask the user to refresh the page to get the latest +changes. + +![](../static/description/notify.png) diff --git a/web_notify_upgrade/static/description/icon.png b/web_notify_upgrade/static/description/icon.png new file mode 100644 index 000000000000..3a0328b516c4 Binary files /dev/null and b/web_notify_upgrade/static/description/icon.png differ diff --git a/web_notify_upgrade/static/description/index.html b/web_notify_upgrade/static/description/index.html new file mode 100644 index 000000000000..cebeaa2aceb4 --- /dev/null +++ b/web_notify_upgrade/static/description/index.html @@ -0,0 +1,436 @@ + + + + + +README.rst + + + +
+ + + +Odoo Community Association + +
+

Web Notify Upgrade

+ +

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

+

This module uses web_notify send a notification to every active users +whenever a module has been installed or upgraded.

+

The notification will ask the user to refresh the page to get the latest +changes.

+

image1

+

Table of contents

+ +
+

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

+
    +
  • Akretion
  • +
+
+
+

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

+

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

+
+
+
+
+ + diff --git a/web_notify_upgrade/static/description/notify.png b/web_notify_upgrade/static/description/notify.png new file mode 100644 index 000000000000..d605e3ff894e Binary files /dev/null and b/web_notify_upgrade/static/description/notify.png differ diff --git a/web_search_deactivate_autosearch/README.rst b/web_search_deactivate_autosearch/README.rst new file mode 100644 index 000000000000..30cfa3252d03 --- /dev/null +++ b/web_search_deactivate_autosearch/README.rst @@ -0,0 +1,111 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + +================================ +Web Search Deactivate Autosearch +================================ + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:d9bf9512061265d595cec81d81fde6964f744374a1d4873b4aebd87e25a82b11 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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 + :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 + :target: https://github.com/OCA/web/tree/19.0/web_search_deactivate_autosearch + :alt: OCA/web +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/web-19-0/web-19-0-web_search_deactivate_autosearch + :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/web&target_branch=19.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +By default, Odoo triggers a new search every time you add or remove a +filter, a group by, or a favorite in the search bar. When you need to +combine several filters before looking at the result, this means the +search is run once per filter, which can be slow and noisy. + +This module adds an "Auto search" checkbox next to the search bar. When +unchecked, adding or removing filters no longer triggers an automatic +search: you can freely combine several filters and only trigger the +search once, by clicking the search icon. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +1. Go to any view with a search bar (e.g. a list or kanban view). +2. Uncheck the "Auto search" checkbox displayed next to the search bar. +3. Add or remove as many filters, group by, or favorites as you need: + the view is not refreshed automatically anymore. +4. Click the search icon to run the search with all the selected filters + at once. +5. Check "Auto search" again to go back to the default behavior. + +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 +------- + +* ACSONE SA/NV + +Contributors +------------ + +- Zina Rasoamanana +- Samir Guesmi + +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. + +.. |maintainer-samirGuesmi| image:: https://github.com/samirGuesmi.png?size=40px + :target: https://github.com/samirGuesmi + :alt: samirGuesmi +.. |maintainer-AnizR| image:: https://github.com/AnizR.png?size=40px + :target: https://github.com/AnizR + :alt: AnizR + +Current `maintainers `__: + +|maintainer-samirGuesmi| |maintainer-AnizR| + +This module is part of the `OCA/web `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/web_search_deactivate_autosearch/__init__.py b/web_search_deactivate_autosearch/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/web_search_deactivate_autosearch/__manifest__.py b/web_search_deactivate_autosearch/__manifest__.py new file mode 100644 index 000000000000..493216b5143b --- /dev/null +++ b/web_search_deactivate_autosearch/__manifest__.py @@ -0,0 +1,21 @@ +# Copyright 2025 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +{ + "name": "Web Search Deactivate Autosearch", + "summary": "Allow user to deactivate autosearch to add multiple filters", + "version": "19.0.1.0.0", + "development_status": "Beta", + "category": "Web", + "website": "https://github.com/OCA/web", + "author": "ACSONE SA/NV, Odoo Community Association (OCA)", + "maintainers": ["samirGuesmi", "AnizR"], + "license": "AGPL-3", + "installable": True, + "depends": ["web"], + "assets": { + "web.assets_backend": [ + "web_search_deactivate_autosearch/static/src/search/search_model.esm.js", + "web_search_deactivate_autosearch/static/src/search/search_bar/*", + ], + }, +} diff --git a/web_search_deactivate_autosearch/i18n/it.po b/web_search_deactivate_autosearch/i18n/it.po new file mode 100644 index 000000000000..9e90695283eb --- /dev/null +++ b/web_search_deactivate_autosearch/i18n/it.po @@ -0,0 +1,21 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_search_deactivate_autosearch +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 19.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" + +#. module: web_search_deactivate_autosearch +#. odoo-javascript +#: code:addons/web_search_deactivate_autosearch/static/src/search/search_bar/search_bar.xml:0 +msgid "Auto search" +msgstr "" diff --git a/web_search_deactivate_autosearch/i18n/web_search_deactivate_autosearch.pot b/web_search_deactivate_autosearch/i18n/web_search_deactivate_autosearch.pot new file mode 100644 index 000000000000..023784ecae01 --- /dev/null +++ b/web_search_deactivate_autosearch/i18n/web_search_deactivate_autosearch.pot @@ -0,0 +1,20 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_search_deactivate_autosearch +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 19.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: web_search_deactivate_autosearch +#. odoo-javascript +#: code:addons/web_search_deactivate_autosearch/static/src/search/search_bar/search_bar.xml:0 +msgid "Auto search" +msgstr "" diff --git a/web_search_deactivate_autosearch/pyproject.toml b/web_search_deactivate_autosearch/pyproject.toml new file mode 100644 index 000000000000..4231d0cccb3d --- /dev/null +++ b/web_search_deactivate_autosearch/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/web_search_deactivate_autosearch/readme/CONTRIBUTORS.md b/web_search_deactivate_autosearch/readme/CONTRIBUTORS.md new file mode 100644 index 000000000000..68d340d91f9d --- /dev/null +++ b/web_search_deactivate_autosearch/readme/CONTRIBUTORS.md @@ -0,0 +1,2 @@ +- Zina Rasoamanana \<\> +- Samir Guesmi \<\> diff --git a/web_search_deactivate_autosearch/readme/DESCRIPTION.md b/web_search_deactivate_autosearch/readme/DESCRIPTION.md new file mode 100644 index 000000000000..8a04c7192c9f --- /dev/null +++ b/web_search_deactivate_autosearch/readme/DESCRIPTION.md @@ -0,0 +1,9 @@ +By default, Odoo triggers a new search every time you add or remove a +filter, a group by, or a favorite in the search bar. When you need to +combine several filters before looking at the result, this means the +search is run once per filter, which can be slow and noisy. + +This module adds an "Auto search" checkbox next to the search bar. When +unchecked, adding or removing filters no longer triggers an automatic +search: you can freely combine several filters and only trigger the +search once, by clicking the search icon. diff --git a/web_search_deactivate_autosearch/readme/USAGE.md b/web_search_deactivate_autosearch/readme/USAGE.md new file mode 100644 index 000000000000..58f4c9541ef5 --- /dev/null +++ b/web_search_deactivate_autosearch/readme/USAGE.md @@ -0,0 +1,7 @@ +1. Go to any view with a search bar (e.g. a list or kanban view). +2. Uncheck the "Auto search" checkbox displayed next to the search bar. +3. Add or remove as many filters, group by, or favorites as you need: + the view is not refreshed automatically anymore. +4. Click the search icon to run the search with all the selected + filters at once. +5. Check "Auto search" again to go back to the default behavior. diff --git a/web_search_deactivate_autosearch/static/description/icon.png b/web_search_deactivate_autosearch/static/description/icon.png new file mode 100644 index 000000000000..3a0328b516c4 Binary files /dev/null and b/web_search_deactivate_autosearch/static/description/icon.png differ diff --git a/web_search_deactivate_autosearch/static/description/index.html b/web_search_deactivate_autosearch/static/description/index.html new file mode 100644 index 000000000000..d78c3cec1dfc --- /dev/null +++ b/web_search_deactivate_autosearch/static/description/index.html @@ -0,0 +1,452 @@ + + + + + +README.rst + + + +
+ + + +Odoo Community Association + +
+

Web Search Deactivate Autosearch

+ +

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

+

By default, Odoo triggers a new search every time you add or remove a +filter, a group by, or a favorite in the search bar. When you need to +combine several filters before looking at the result, this means the +search is run once per filter, which can be slow and noisy.

+

This module adds an “Auto search” checkbox next to the search bar. When +unchecked, adding or removing filters no longer triggers an automatic +search: you can freely combine several filters and only trigger the +search once, by clicking the search icon.

+

Table of contents

+ +
+

Usage

+
    +
  1. Go to any view with a search bar (e.g. a list or kanban view).
  2. +
  3. Uncheck the “Auto search” checkbox displayed next to the search bar.
  4. +
  5. Add or remove as many filters, group by, or favorites as you need: +the view is not refreshed automatically anymore.
  6. +
  7. Click the search icon to run the search with all the selected filters +at once.
  8. +
  9. Check “Auto search” again to go back to the default behavior.
  10. +
+
+
+

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

+
    +
  • ACSONE SA/NV
  • +
+
+
+

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.

+

Current maintainers:

+

samirGuesmi AnizR

+

This module is part of the OCA/web project on GitHub.

+

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

+
+
+
+
+ + diff --git a/web_search_deactivate_autosearch/static/src/search/search_bar/search_bar.esm.js b/web_search_deactivate_autosearch/static/src/search/search_bar/search_bar.esm.js new file mode 100644 index 000000000000..b6ee0abbbfb6 --- /dev/null +++ b/web_search_deactivate_autosearch/static/src/search/search_bar/search_bar.esm.js @@ -0,0 +1,40 @@ +import {SearchBar} from "@web/search/search_bar/search_bar"; +import {browser} from "@web/core/browser/browser"; +import {patch} from "@web/core/utils/patch"; +import {useBus} from "@web/core/utils/hooks"; + +patch(SearchBar.prototype, { + setup() { + super.setup(...arguments); + this.autosearch = + browser.localStorage.getItem( + `odoo.deactivateAutoSearch.${this.env.searchModel.resModel}` + ) !== "true"; + useBus(this.env.searchModel, "force-search-bar-update", this.render); + }, + + toggleAutoSearch() { + const deactivate = + browser.localStorage.getItem( + `odoo.deactivateAutoSearch.${this.env.searchModel.resModel}` + ) !== "true"; + browser.localStorage.setItem( + `odoo.deactivateAutoSearch.${this.env.searchModel.resModel}`, + deactivate + ); + this.autosearch = !deactivate; + this.env.searchModel._notify(); + }, + + onClickSearchIcon() { + const deactivateAutoSearch = + browser.localStorage.getItem( + `odoo.deactivateAutoSearch.${this.env.searchModel.resModel}` + ) === "true"; + if (deactivateAutoSearch) { + this.env.searchModel.trigger_search(); + } else { + super.onClickSearchIcon(...arguments); + } + }, +}); diff --git a/web_search_deactivate_autosearch/static/src/search/search_bar/search_bar.xml b/web_search_deactivate_autosearch/static/src/search/search_bar/search_bar.xml new file mode 100644 index 000000000000..f576f522451e --- /dev/null +++ b/web_search_deactivate_autosearch/static/src/search/search_bar/search_bar.xml @@ -0,0 +1,28 @@ + + + + +
+ + +
+
+
+
diff --git a/web_search_deactivate_autosearch/static/src/search/search_model.esm.js b/web_search_deactivate_autosearch/static/src/search/search_model.esm.js new file mode 100644 index 000000000000..ebdabac0f36b --- /dev/null +++ b/web_search_deactivate_autosearch/static/src/search/search_model.esm.js @@ -0,0 +1,31 @@ +import {SearchModel} from "@web/search/search_model"; +import {browser} from "@web/core/browser/browser"; +import {patch} from "@web/core/utils/patch"; + +patch(SearchModel.prototype, { + async _notify() { + const deactivateAutoSearch = + browser.localStorage.getItem( + `odoo.deactivateAutoSearch.${this.resModel}` + ) === "true"; + if (deactivateAutoSearch) { + if (this.blockNotification) { + return; + } + this._reset(); + await this._reloadSections(); + this.trigger("force-search-bar-update"); + return; + } + return super._notify(...arguments); + }, + + async trigger_search() { + if (this.blockNotification) { + return; + } + this._reset(); + await this._reloadSections(); + this.trigger("update"); + }, +});