Daily updates from Odoo
Wednesday, July 19, 2023
2 changes · master
New functionality added to Odoo
Odoo can now send message notifications to users through browser and PWA push notifications, even when the Odoo tab or app is closed. This brings web notifications closer to the mobile app experience and helps users stay informed about important activity in real time.
Original PR description
* = test_mail_enterprise WebPush allows to send data to the user browser/app(PWA) even when tab/app is closed. Web push is a "constant" link between the ServiceWorker of browser/app and a WebPush…
* = test_mail_enterprise
WebPush allows to send data to the user browser/app(PWA) even when
tab/app is closed. Web push is a "constant" link between the
ServiceWorker of browser/app and a WebPush server.
Note that each browser have it's owns custom WebPush server.
e.g.:
* Chrome: https://fcm.googleapis.com/
* Firefox: https://updates.push.services.mozilla.com/
* Safari: https://web.push.apple.com/
* Edge: https://wns2-ln2p.notify.windows.com/
WebPush introduces some cryptographic notion to ensure some the
reliability of the data sent:
1. VAPID: "Voluntary Application Server Identification" is the standard
used to generate the public and the private to sign the message
between the browser and the WebPush server
2. JWT: "JSON Web Token" is the standard used to sign the payload to the
WebPush server
3. ECE: "Encrypted Content-Encoding" is the standard used by WebPush to
encrypt the data of the payload to avoid sending RAW data
outside trusted network.
Simplified steps how to WebPush works:
1. The Javascript code of a web page subscribes to the WebPush server
(using the VAPID key generated at mail_entreprise install).
2. The WebPush server replay with a subscription (and some other infos
like the unique URL endpoint per subscription where to send a
notification)
3. The application (odoo-bin in our case) sends a post request to the
WebPush server using the specific URL endpoint of the user (using JWT
and ECE).
4. The WebPush server sends back to the browser the encrypted payload.
5. The browser decrypts the payload and sends it to the ServiceWorker
linked to the subscription.
Here a [Sequence diagram](https://w3c.github.io/push-api/index.html#fig-example-flow-of-events-for-subscription-push-message-delivery-and-unsubscription) of all interactions to process a web push notification.
In Odoo, we use WebPush to send Notification to the user.
This commit aims to have a parity with the Android/iOS Mobile App at
the notification level.
Notes:
There are some ways to encrypt (ECE) the message for WebPush:
* AESGCM128: this is a draft
* AESGCM: very well documented
* AES128GCM: RFC8188 Standard encoding
We implement only the RFC one as it is the only one implemented in all
major updated browser (Chrome, Firefox, Safari, Edge, ...)
You need to allow the desktop "Notification" and "Push" inside your
browser. For iOS Devices, it only works on iOS 16.4+ and it's requiring
Odoo to first be added to the Home Screen. It's delivered silently,
meaning no sound, vibration, haptics or screen wake.
Note:
Notifications are sent directly if there are less than 5 notifications,
otherwise we use a cron triggered immediately.
Also, we have changed the value of the "QueryCount" as `mail_enterprise`
executes a new query to search the devices associated with the partner.
We have added a "try/except" for any Exception before the
`push_to_end_point` method as we want to avoid blocking a normal flow
just for a not mandatory push notification if something happens during
the push to the endpoint.
See:
https://github.com/odoo/enterprise/commit/d0ae70103dd1c169debe8fcb0918f80310c85e42
Links:
- https://www.rfc-editor.org/rfc/rfc8030
- https://www.rfc-editor.org/rfc/rfc8188
- https://www.rfc-editor.org/rfc/rfc8291
- https://www.rfc-editor.org/rfc/rfc8292
- https://w3c.github.io/push-api/index.html
- https://autopush.readthedocs.io/en/latest/http.html
- https://web.dev/push-notifications-web-push-protocol/
- https://github.com/web-push-libs/encrypted-content-encoding
- https://github.com/web-push-libs/pywebpush
- https://github.com/web-push-libs/vapid
- https://caniuse.com/push-api
Task ID: 3123678
Co-authored-by: Romeo Fragomeli <rfr@odoo.com>Appointment managers can now plan staff and resource bookings in a Gantt-style timeline, making availability and scheduling conflicts easier to see at a glance. The update also adds practical tools to record and manage resource leave directly from appointment workflows, so unavailable courts, rooms, equipment, or staff are better reflected in scheduling.
Original PR description
PURPOSE This merge commit aims to introduce a gantt view to allow users to easily manage the appointments of staff and resources from the backend. It also introduces a leave management interface for…
PURPOSE This merge commit aims to introduce a gantt view to allow users to easily manage the appointments of staff and resources from the backend. It also introduces a leave management interface for the resources. SPECS The merge commit is split into 4 different sub-commits: - add the main resource on calendar.event This is essentially a preparatory commit as having a (stored) field containing the appointment resource on the calendar.event model is necessary to be able to create a gantt view grouping bookings by the resource. This field is populated by copying the resource of the booking line, if there is only one (from the booking_line_ids relationship). - add the gantt view to the appointment module As explained previously, this is the main commit that adds the gantt view to manage resource bookings as well as staff meetings (based on the appointment type configuration). Through this view, one can manage for example a tennis court business, by being able to quickly create bookings for its tennis courts (and seeing at a glance which ones are available). - improve appointment actions & menus The commit purpose is mainly to open the right view for the right use case. Based on the appointment type configuration (resources / people, manage capabilities, ...), it might be more appropriate to open either a gantt, a calendar view, a list view, ... - add a leave management interface for resources We add additional menus & wizards to make it easier for the end user to encode leaves for the appointment resources. See underlying commits for more details. Task-3101589