diff --git a/mail_notification_sound_volume/README.rst b/mail_notification_sound_volume/README.rst new file mode 100644 index 000000000..d58b19249 --- /dev/null +++ b/mail_notification_sound_volume/README.rst @@ -0,0 +1,87 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + +======================== +Mail Notification Volume +======================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:24aa7ba3b28cb05fdfd98de0e1d0d07ef49fa39c4d517b7227b3d162691a3954 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Fmail-lightgray.png?logo=github + :target: https://github.com/OCA/mail/tree/19.0/mail_notification_sound_volume + :alt: OCA/mail +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/mail-19-0/mail-19-0-mail_notification_sound_volume + :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/mail&target_branch=19.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows users to configure the volume of notification sounds +in Odoo (chat messages, inbox notifications, etc.). + +A volume slider is added to the user's Preferences page, with a test +button to preview the sound at the selected volume. The slider is only +visible when notifications are managed within Odoo. + +By default, the volume is set to 100%. + +**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 +------- + +* ForgeFlow + +Contributors +------------ + +- Andreu Orensanz + +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/mail `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/mail_notification_sound_volume/__init__.py b/mail_notification_sound_volume/__init__.py new file mode 100644 index 000000000..62c7e3b07 --- /dev/null +++ b/mail_notification_sound_volume/__init__.py @@ -0,0 +1,4 @@ +# Copyright 2026 ForgeFlow S.L. (https://www.forgeflow.com) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import models diff --git a/mail_notification_sound_volume/__manifest__.py b/mail_notification_sound_volume/__manifest__.py new file mode 100644 index 000000000..c055fdb1f --- /dev/null +++ b/mail_notification_sound_volume/__manifest__.py @@ -0,0 +1,25 @@ +# Copyright 2026 ForgeFlow S.L. (https://www.forgeflow.com) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +{ + "name": "Mail Notification Volume", + "summary": "Allow users to configure notification sound volume", + "version": "19.0.1.0.0", + "development_status": "Beta", + "category": "Social Network", + "website": "https://github.com/OCA/mail", + "author": "ForgeFlow, Odoo Community Association (OCA)", + "license": "AGPL-3", + "installable": True, + "depends": ["mail"], + "data": [ + "views/res_users_views.xml", + ], + "assets": { + "web.assets_backend": [ + "mail_notification_sound_volume/static/src/settings_model_patch.esm.js", + "mail_notification_sound_volume/static/src/out_of_focus_service_patch.esm.js", + "mail_notification_sound_volume/static/src/volume_slider_field.esm.js", + "mail_notification_sound_volume/static/src/volume_slider_field.xml", + ], + }, +} diff --git a/mail_notification_sound_volume/i18n/es.po b/mail_notification_sound_volume/i18n/es.po new file mode 100644 index 000000000..84e4d7585 --- /dev/null +++ b/mail_notification_sound_volume/i18n/es.po @@ -0,0 +1,47 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_notification_sound_volume +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 17.0+e\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2026-04-17 11:19+0000\n" +"PO-Revision-Date: 2026-04-17 11:19+0000\n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: mail_notification_sound_volume +#: model:ir.model.fields,field_description:mail_notification_sound_volume.field_res_users__notification_volume +#: model:ir.model.fields,field_description:mail_notification_sound_volume.field_res_users_settings__notification_volume +msgid "Notification Volume" +msgstr "Volumen notificaciones" + +#. module: mail_notification_sound_volume +#. odoo-javascript +#: code:addons/mail_notification_sound_volume/static/src/volume_slider_field.xml:0 +#, python-format +msgid "Test sound" +msgstr "" + +#. module: mail_notification_sound_volume +#: model:ir.model,name:mail_notification_sound_volume.model_res_users +msgid "User" +msgstr "Usuario" + +#. module: mail_notification_sound_volume +#: model:ir.model,name:mail_notification_sound_volume.model_res_users_settings +msgid "User Settings" +msgstr "Ajustes de usuario" + +#. module: mail_notification_sound_volume +#. odoo-javascript +#: code:addons/mail_notification_sound_volume/static/src/volume_slider_field.esm.js:0 +#, python-format +msgid "Volume Slider" +msgstr "" diff --git a/mail_notification_sound_volume/i18n/it.po b/mail_notification_sound_volume/i18n/it.po new file mode 100644 index 000000000..12a5ae60b --- /dev/null +++ b/mail_notification_sound_volume/i18n/it.po @@ -0,0 +1,47 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_notification_sound_volume +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 17.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2026-05-13 08:34+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.15.2\n" + +#. module: mail_notification_sound_volume +#: model:ir.model.fields,field_description:mail_notification_sound_volume.field_res_users__notification_volume +#: model:ir.model.fields,field_description:mail_notification_sound_volume.field_res_users_settings__notification_volume +msgid "Notification Volume" +msgstr "Volume notifica" + +#. module: mail_notification_sound_volume +#. odoo-javascript +#: code:addons/mail_notification_sound_volume/static/src/volume_slider_field.xml:0 +#, python-format +msgid "Test sound" +msgstr "Suono di test" + +#. module: mail_notification_sound_volume +#: model:ir.model,name:mail_notification_sound_volume.model_res_users +msgid "User" +msgstr "Utente" + +#. module: mail_notification_sound_volume +#: model:ir.model,name:mail_notification_sound_volume.model_res_users_settings +msgid "User Settings" +msgstr "Impostazioni utente" + +#. module: mail_notification_sound_volume +#. odoo-javascript +#: code:addons/mail_notification_sound_volume/static/src/volume_slider_field.esm.js:0 +#, python-format +msgid "Volume Slider" +msgstr "Regolatore volume" diff --git a/mail_notification_sound_volume/i18n/mail_notification_sound_volume.pot b/mail_notification_sound_volume/i18n/mail_notification_sound_volume.pot new file mode 100644 index 000000000..0b14e3d5d --- /dev/null +++ b/mail_notification_sound_volume/i18n/mail_notification_sound_volume.pot @@ -0,0 +1,44 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_notification_sound_volume +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 17.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: mail_notification_sound_volume +#: model:ir.model.fields,field_description:mail_notification_sound_volume.field_res_users__notification_volume +#: model:ir.model.fields,field_description:mail_notification_sound_volume.field_res_users_settings__notification_volume +msgid "Notification Volume" +msgstr "" + +#. module: mail_notification_sound_volume +#. odoo-javascript +#: code:addons/mail_notification_sound_volume/static/src/volume_slider_field.xml:0 +#, python-format +msgid "Test sound" +msgstr "" + +#. module: mail_notification_sound_volume +#: model:ir.model,name:mail_notification_sound_volume.model_res_users +msgid "User" +msgstr "" + +#. module: mail_notification_sound_volume +#: model:ir.model,name:mail_notification_sound_volume.model_res_users_settings +msgid "User Settings" +msgstr "" + +#. module: mail_notification_sound_volume +#. odoo-javascript +#: code:addons/mail_notification_sound_volume/static/src/volume_slider_field.esm.js:0 +#, python-format +msgid "Volume Slider" +msgstr "" diff --git a/mail_notification_sound_volume/models/__init__.py b/mail_notification_sound_volume/models/__init__.py new file mode 100644 index 000000000..587fee466 --- /dev/null +++ b/mail_notification_sound_volume/models/__init__.py @@ -0,0 +1,5 @@ +# Copyright 2026 ForgeFlow S.L. (https://www.forgeflow.com) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import res_users +from . import res_users_settings diff --git a/mail_notification_sound_volume/models/res_users.py b/mail_notification_sound_volume/models/res_users.py new file mode 100644 index 000000000..900bc0021 --- /dev/null +++ b/mail_notification_sound_volume/models/res_users.py @@ -0,0 +1,21 @@ +# Copyright 2026 ForgeFlow S.L. (https://www.forgeflow.com) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + + +class ResUsers(models.Model): + _inherit = "res.users" + + notification_volume = fields.Float( + related="res_users_settings_id.notification_volume", + readonly=False, + ) + + @property + def SELF_READABLE_FIELDS(self): + return super().SELF_READABLE_FIELDS + ["notification_volume"] + + @property + def SELF_WRITEABLE_FIELDS(self): + return super().SELF_WRITEABLE_FIELDS + ["notification_volume"] diff --git a/mail_notification_sound_volume/models/res_users_settings.py b/mail_notification_sound_volume/models/res_users_settings.py new file mode 100644 index 000000000..376c65ad6 --- /dev/null +++ b/mail_notification_sound_volume/models/res_users_settings.py @@ -0,0 +1,10 @@ +# Copyright 2026 ForgeFlow S.L. (https://www.forgeflow.com) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + + +class ResUsersSettings(models.Model): + _inherit = "res.users.settings" + + notification_volume = fields.Float(default=1.0) diff --git a/mail_notification_sound_volume/pyproject.toml b/mail_notification_sound_volume/pyproject.toml new file mode 100644 index 000000000..4231d0ccc --- /dev/null +++ b/mail_notification_sound_volume/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/mail_notification_sound_volume/readme/CONTRIBUTORS.md b/mail_notification_sound_volume/readme/CONTRIBUTORS.md new file mode 100644 index 000000000..3c48b3419 --- /dev/null +++ b/mail_notification_sound_volume/readme/CONTRIBUTORS.md @@ -0,0 +1 @@ +- Andreu Orensanz \ diff --git a/mail_notification_sound_volume/readme/DESCRIPTION.md b/mail_notification_sound_volume/readme/DESCRIPTION.md new file mode 100644 index 000000000..d1fe417f9 --- /dev/null +++ b/mail_notification_sound_volume/readme/DESCRIPTION.md @@ -0,0 +1,8 @@ +This module allows users to configure the volume of notification sounds +in Odoo (chat messages, inbox notifications, etc.). + +A volume slider is added to the user's Preferences page, with a test +button to preview the sound at the selected volume. The slider is only +visible when notifications are managed within Odoo. + +By default, the volume is set to 100%. diff --git a/mail_notification_sound_volume/static/description/icon.png b/mail_notification_sound_volume/static/description/icon.png new file mode 100644 index 000000000..1dcc49c24 Binary files /dev/null and b/mail_notification_sound_volume/static/description/icon.png differ diff --git a/mail_notification_sound_volume/static/description/index.html b/mail_notification_sound_volume/static/description/index.html new file mode 100644 index 000000000..86f1f2ae7 --- /dev/null +++ b/mail_notification_sound_volume/static/description/index.html @@ -0,0 +1,434 @@ + + + + + +README.rst + + + +
+ + + +Odoo Community Association + +
+

Mail Notification Volume

+ +

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

+

This module allows users to configure the volume of notification sounds +in Odoo (chat messages, inbox notifications, etc.).

+

A volume slider is added to the user’s Preferences page, with a test +button to preview the sound at the selected volume. The slider is only +visible when notifications are managed within Odoo.

+

By default, the volume is set to 100%.

+

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

+
    +
  • 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/mail project on GitHub.

+

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

+
+
+
+
+ + diff --git a/mail_notification_sound_volume/static/src/out_of_focus_service_patch.esm.js b/mail_notification_sound_volume/static/src/out_of_focus_service_patch.esm.js new file mode 100644 index 000000000..506372876 --- /dev/null +++ b/mail_notification_sound_volume/static/src/out_of_focus_service_patch.esm.js @@ -0,0 +1,15 @@ +import {OutOfFocusService} from "@mail/core/common/out_of_focus_service"; +import {patch} from "@web/core/utils/patch"; + +patch(OutOfFocusService.prototype, { + async _playSound() { + if ( + this.canPlayAudio && + this.store.settings.messageSound && + (await this.multiTab.isOnMainTab()) + ) { + const volume = this.store.settings.notification_volume ?? 1; + this.soundEffectService.play("new-message", {volume}); + } + }, +}); diff --git a/mail_notification_sound_volume/static/src/settings_model_patch.esm.js b/mail_notification_sound_volume/static/src/settings_model_patch.esm.js new file mode 100644 index 000000000..ac3388ac9 --- /dev/null +++ b/mail_notification_sound_volume/static/src/settings_model_patch.esm.js @@ -0,0 +1,10 @@ +import {Settings} from "@mail/core/common/settings_model"; +import {fields} from "@mail/core/common/record"; +import {patch} from "@web/core/utils/patch"; + +patch(Settings.prototype, { + setup() { + super.setup(...arguments); + this.notification_volume = fields.Attr(1.0); + }, +}); diff --git a/mail_notification_sound_volume/static/src/volume_slider_field.esm.js b/mail_notification_sound_volume/static/src/volume_slider_field.esm.js new file mode 100644 index 000000000..122bfc843 --- /dev/null +++ b/mail_notification_sound_volume/static/src/volume_slider_field.esm.js @@ -0,0 +1,56 @@ +import {Component} from "@odoo/owl"; +import {_t} from "@web/core/l10n/translation"; +import {registry} from "@web/core/registry"; +import {standardFieldProps} from "@web/views/fields/standard_field_props"; +import {url} from "@web/core/utils/urls"; +import {useService} from "@web/core/utils/hooks"; + +export class VolumeSliderField extends Component { + static template = "mail_notification_sound_volume.VolumeSliderField"; + static props = { + ...standardFieldProps, + }; + + setup() { + this.testAudio = null; + this.store = useService("mail.store"); + } + + get value() { + return this.props.record.data[this.props.name] || 0; + } + + get percentage() { + return Math.round(this.value * 100); + } + + onChange(ev) { + const value = parseFloat(ev.target.value); + this.props.record.update({[this.props.name]: value}); + if (this.store.settings) { + this.store.settings.notification_volume = value; + } + } + + onTestSound() { + if (!this.testAudio) { + this.testAudio = new Audio(); + this.testAudio.src = this.testAudio.canPlayType("audio/ogg; codecs=vorbis") + ? url("/mail/static/src/audio/ting.ogg") + : url("/mail/static/src/audio/ting.mp3"); + } + this.testAudio.volume = this.value; + this.testAudio.currentTime = 0; + this.testAudio.play().catch(() => { + // Ignore autoplay errors + }); + } +} + +export const volumeSliderField = { + component: VolumeSliderField, + displayName: _t("Volume Slider"), + supportedTypes: ["float"], +}; + +registry.category("fields").add("volume_slider", volumeSliderField); diff --git a/mail_notification_sound_volume/static/src/volume_slider_field.xml b/mail_notification_sound_volume/static/src/volume_slider_field.xml new file mode 100644 index 000000000..ec96d0dfd --- /dev/null +++ b/mail_notification_sound_volume/static/src/volume_slider_field.xml @@ -0,0 +1,36 @@ + + + + + + + + +
+ + +
+
+
+ +
diff --git a/mail_notification_sound_volume/views/res_users_views.xml b/mail_notification_sound_volume/views/res_users_views.xml new file mode 100644 index 000000000..c8d89684a --- /dev/null +++ b/mail_notification_sound_volume/views/res_users_views.xml @@ -0,0 +1,18 @@ + + + + res.users.preferences.form.notification.volume + res.users + + + + + + + +