Skip to content

Conversation

@lef-adhoc
Copy link
Contributor

No description provided.

lmignon and others added 30 commits December 1, 2025 00:09
This technical module allows you to send instant notification messages from the server to the user in live.
Fix a check when comparing a user count with items within a mock call.

The previous method was succeeding by pure luck because OCA test
databases contain 2 users, which happens to be the amount of items
within a mock "call_args" (it contains args + kwargs).
- Use the 'session' class of the JS Framework (session no lounger bound
to web client)
- Test change: compare emitted & received messages based on content, not
order. Using string comparison raises false positives.
Currently translated at 100,0% (5 of 5 strings)

Translation: web-11.0/web-11.0-web_notify
Translate-URL: https://translation.odoo-community.org/projects/web-11-0/web-11-0-web_notify/pt_BR/
Currently translated at 40.0% (2 of 5 strings)

Translation: web-11.0/web-11.0-web_notify
Translate-URL: https://translation.odoo-community.org/projects/web-11-0/web-11-0-web_notify/da/
Only the admin user (sudo) is allowed to send notifications to other
users. The normal users can only send notifications to themselves.

This is to prevent attackers to craft malicious notifications and send
them to other users using RPC.

Correction based on the idea of @hbrunn
Add self-test buttons in demo environment,
Updated readme to show how to test it.
Add buttons to users form
Do not rely on SUPERUSER_ID and avoid getattr usage
Updated by Update PO files to match POT (msgmerge) hook in Weblate.
* [ADD]: all available bootstrap notifications (success/danger/warning/info/default)
* [IMP] use black color for text for default notification.
* [FIX] reverted require string for `bus.Longpolling` and rename `on_message_received` to `on_message` to prevent collisions.
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: web-12.0/web-12.0-web_notify
Translate-URL: https://translation.odoo-community.org/projects/web-12-0/web-12-0-web_notify/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: web-12.0/web-12.0-web_notify
Translate-URL: https://translation.odoo-community.org/projects/web-12-0/web-12-0-web_notify/
It seems besides the custom channels provided in this addon it also catches messages from other channels. E.g. in this case it seems the void popup is triggered by these activity creation bus messages.

**Steps to reproduce**

Odoo commit: could reproduce on 5e8b667951 and 4da82776ff
OCA/web commit: 2465278

* Install crm and web_notify modules
* Create an activity for yourself (tried for admin user)
* Empty popup appears

**Attempt to solve**

It seems the bus handles all messages non exclusively. I've hacked in a conditional to handle only messages from web_notify addon, but its unclear wether this does not break something else.
Currently translated at 100.0% (18 of 18 strings)

Translation: web-12.0/web-12.0-web_notify
Translate-URL: https://translation.odoo-community.org/projects/web-12-0/web-12-0-web_notify/pt_BR/
Currently translated at 100.0% (18 of 18 strings)

Translation: web-12.0/web-12.0-web_notify
Translate-URL: https://translation.odoo-community.org/projects/web-12-0/web-12-0-web_notify/zh_CN/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: web-13.0/web-13.0-web_notify
Translate-URL: https://translation.odoo-community.org/projects/web-13-0/web-13-0-web_notify/
Includes some manual fixes to silent ESLint warnings.
Currently translated at 100.0% (18 of 18 strings)

Translation: web-13.0/web-13.0-web_notify
Translate-URL: https://translation.odoo-community.org/projects/web-13-0/web-13-0-web_notify/de/
adrianojprado and others added 25 commits December 1, 2025 00:09
Currently translated at 100.0% (18 of 18 strings)

Translation: web-16.0/web-16.0-web_notify
Translate-URL: https://translation.odoo-community.org/projects/web-16-0/web-16-0-web_notify/pt_BR/
When trying to use the notify function that comes from a normal user with sudo flag enabled, it wasn't letting the user access it. Adding the su flag to the check should allow sudo users using this feature.
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: web-16.0/web-16.0-web_notify
Translate-URL: https://translation.odoo-community.org/projects/web-16-0/web-16-0-web_notify/
Currently translated at 100.0% (19 of 19 strings)

Translation: web-16.0/web-16.0-web_notify
Translate-URL: https://translation.odoo-community.org/projects/web-16-0/web-16-0-web_notify/it/
Currently translated at 100.0% (19 of 19 strings)

Translation: web-16.0/web-16.0-web_notify
Translate-URL: https://translation.odoo-community.org/projects/web-16-0/web-16-0-web_notify/pt_BR/
- We can now set a button name to the notification action.
- We can set an icon button as well.
- After the button is clicked, the notification gets closed.
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: web-18.0/web-18.0-web_notify
Translate-URL: https://translation.odoo-community.org/projects/web-18-0/web-18-0-web_notify/
Change the License to LGPL-3 in order to be able to use this module with other modules with non-AGPL-3 licenses.

Task: 4758
@lef-adhoc lef-adhoc force-pushed the 19.0-mig-web_notify branch from d33d269 to 43434c9 Compare December 1, 2025 03:18
@lef-adhoc lef-adhoc force-pushed the 19.0-mig-web_notify branch from 43434c9 to d8685e7 Compare December 1, 2025 03:24
@lef-adhoc lef-adhoc mentioned this pull request Dec 1, 2025
42 tasks
@GarethGloSystems
Copy link

Warning:

#3291 introduced a bug to the 18.0 branch (messageIsHtml doesn't exist) which is being propagated to this PR

The proposed fix #3379 hasn't been merged into the 18.0 branch yet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment