Daily updates from Odoo
Wednesday, April 10, 2024
4 changes
Code cleanup and technical improvements
This update reorganizes internal Discuss and messaging code to make it easier for Odoo teams to maintain and test. It affects related business apps that use chatter, comments, calls, documents, signing, spreadsheets, and project communication, without introducing a new user-facing feature.
Original PR description
- move many services function to record methods - rename `Record._store` to `Record.store`, for consistency and reasurre it's fine to rely on store in code of models - replace explicit `rpcWithEnv` to `mail.rpc` service. This is slightly easier to use and maintain in code, and is more exact to how HOOT works. https://github.com/odoo/odoo/pull/160798
This update simplifies the internal code that powers discussions, comments, and related messaging features across several apps. It should make future maintenance easier and reduce complexity without changing the intended user experience.
Original PR description
Discuss code is more complicated than it should. Part of it
comes from split in arbitrary services, which are both confusing
and very verbose.
This commit removes the `mail.message` service: related features
have been moved to the appropriate model.
For example:
```js
this.env.services["mail.message"].edit(message, "new-content");
// =>
message.edit("new-content");
```
https://github.com/odoo/odoo/pull/161255This update simplifies the internal code behind Odoo discussions by moving responsibilities from separate technical services into the relevant records themselves. It should make future maintenance easier and reduce complexity without changing the day-to-day user experience.
Original PR description
Discuss code is more complicated than it should. Part of it comes from split in arbitrary services, which are both confusing and very verbose. This commit removes the `mail.persona` service: related features have been moved to the appropriate model. For example: ```js this.env.services["mail.persona"].updateGuestName(guest, newName); // => guest.updateGuestName(newName); ``` Note: persona mixes partners & guests. This method only applies to guests, hence keeping the "guest" word in method name. https://github.com/odoo/odoo/pull/161266
The Discuss code has been streamlined by moving attachment actions into the relevant data models instead of a separate service. This reduces internal complexity and makes future maintenance easier, with little expected direct impact for end users.
Original PR description
Discuss code is more complicated than it should. Part of it comes from split in arbitrary services, which are both confusing and very verbose. This commit removes the `mail.attachment` service: related features have been moved to the appropriate model. For example: ```js this.env.services["mail.attachment"].remove(attachment); // => attachment.delete(); ``` Note: remove/delete wording in service was conflicting with core model feature, e.g. "delete" means server-side deletion while "remove" is basically record.delete(). To match wording with other parts of code, their name have been inverted: - server-side deletion is "remove" - local deletion is "delete"