Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ADD] New module mail_discuss_security to hide 'Discuss' Application by default #1423

Merged
merged 1 commit into from
Oct 1, 2024

Conversation

legalsylvain
Copy link
Contributor

@legalsylvain legalsylvain commented Jul 23, 2024

trivial module.

Description

In odoo, by default, all user can see messages ("Discuss" menu entry).
This feature is not interesting in some instances.

This module so creates a new group 'See Discuss Menu' to display this entry menu
and users are not member of this group by default.

menu_list

Also in the systray, the message icon is removed:

systray

Copy link

@quentinDupont quentinDupont left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with success on runboat and code review ✔️

@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@hbrunn
Copy link
Member

hbrunn commented Aug 5, 2024

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

On my way to merge this fine PR!
Prepared branch 16.0-ocabot-merge-pr-1423-by-hbrunn-bump-nobump, awaiting test results.

OCA-git-bot added a commit that referenced this pull request Aug 5, 2024
Signed-off-by hbrunn
@OCA-git-bot
Copy link
Contributor

@hbrunn your merge command was aborted due to failed check(s), which you can inspect on this commit of 16.0-ocabot-merge-pr-1423-by-hbrunn-bump-nobump.

After fixing the problem, you can re-issue a merge command. Please refrain from merging manually as it will most probably make the target branch red.

@legalsylvain
Copy link
Contributor Author

legalsylvain commented Sep 26, 2024

Hi all. I have a problem with the current implementation of this module.

UPDATE : removing the line - dependencies: ["messaging"], looks to fix the problem.

Step to reproduce :

  • install mail_discuss_group
  • All is working perfectly, element are hidden (and shown if we are member of the new group)
  • Install point_of_sale module and launch point of sale.
  • a blocking javascript error occures
Click to see Javascript error Unncaught (in promise) Error: Some services could not be started: mail_discuss_group_systray_service. Missing dependencies: messaging _startServices env.js:156 startServices env.js:85 startWebClient start.js:33 startPosApp main.js:33 main.js:36 def boot.js:128 processJob boot.js:126 processJobs boot.js:197 def boot.js:138 promise callback*processJobs/processJob/def< boot.js:135 processJob boot.js:126 processJobs boot.js:197 def boot.js:138 promise callback*processJobs/processJob/def< boot.js:135 processJob boot.js:126 processJobs boot.js:197 define boot.js:254 point_of_sale.assets_backend_prod_only.js:236 [env.js:156](http://localhost:8016/web/static/src/env.js) startWebClient start.js:33 AsyncFunctionThrow self-hosted:811 (Asynchrone : async) startPosApp main.js:33 main.js:36 def boot.js:128 processJob boot.js:126 processJobs boot.js:197 def boot.js:138 (Asynchrone : promise callback) def boot.js:135 processJob boot.js:126 processJobs boot.js:197 def boot.js:138 (Asynchrone : promise callback) def boot.js:135 processJob boot.js:126 processJobs boot.js:197 define boot.js:254 point_of_sale.assets_backend_prod_only.js:236

Error: Some services could not be started: mail_discuss_group_systray_service. Missing dependencies: messaging
_startServices@http://localhost:8016/web/assets/debug/point_of_sale.pos_assets_backend.js:64540:15 (/web/static/src/env.js:156)
asyncstartServices@http://localhost:8016/web/assets/debug/point_of_sale.pos_assets_backend.js:64469:11 (/web/static/src/env.js:85)
async
startWebClient@http://localhost:8016/web/assets/debug/point_of_sale.assets_backend_prod_only.js:183:11 (/web/static/src/start.js:33)
startPosApp@http://localhost:8016/web/assets/debug/point_of_sale.assets_backend_prod_only.js:135:19 (/point_of_sale/static/src/entry/main.js:33)
@http://localhost:8016/web/assets/debug/point_of_sale.assets_backend_prod_only.js:138:1 (/point_of_sale/static/src/entry/main.js:36)
processJobs/processJob/def<@http://localhost:8016/web/assets/debug/web.assets_common.js:162:47 (/web/static/src/boot.js:128)
processJob@http://localhost:8016/web/assets/debug/web.assets_common.js:160:27 (/web/static/src/boot.js:126)
processJobs@http://localhost:8016/web/assets/debug/web.assets_common.js:231:27 (/web/static/src/boot.js:197)
processJobs/processJob/def</<@http://localhost:8016/web/assets/debug/web.assets_common.js:172:48 (/web/static/src/boot.js:138)
promise callbackprocessJobs/processJob/def<@http://localhost:8016/web/assets/debug/web.assets_common.js:169:30 (/web/static/src/boot.js:135)
processJob@http://localhost:8016/web/assets/debug/web.assets_common.js:160:27 (/web/static/src/boot.js:126)
processJobs@http://localhost:8016/web/assets/debug/web.assets_common.js:231:27 (/web/static/src/boot.js:197)
processJobs/processJob/def</<@http://localhost:8016/web/assets/debug/web.assets_common.js:172:48 (/web/static/src/boot.js:138)
promise callback
processJobs/processJob/def<@http://localhost:8016/web/assets/debug/web.assets_common.js:169:30 (/web/static/src/boot.js:135)
processJob@http://localhost:8016/web/assets/debug/web.assets_common.js:160:27 (/web/static/src/boot.js:126)
processJobs@http://localhost:8016/web/assets/debug/web.assets_common.js:231:27 (/web/static/src/boot.js:197)
odoo.define@http://localhost:8016/web/assets/debug/web.assets_common.js:288:24 (/web/static/src/boot.js:254)
@http://localhost:8016/web/assets/debug/point_of_sale.assets_backend_prod_only.js:236:6 (http://localhost:8016/web/assets/debug/point_of_sale.assets_backend_prod_only.js:236) error_service.js:73
handleError error_service.js:73
start error_service.js:130
start error_service.js:119
start env.js:111
_startServices env.js:142
startServices env.js:85
startWebClient start.js:33
startPosApp main.js:33
main.js:36
def boot.js:128
processJob boot.js:126
processJobs boot.js:197
def boot.js:138
(Asynchrone : promise callback)
def boot.js:135
processJob boot.js:126
processJobs boot.js:197
def boot.js:138
(Asynchrone : promise callback)
def boot.js:135
processJob boot.js:126
processJobs boot.js:197
define boot.js:254
point_of_sale.assets_backend_prod_only.js:236

Uncaught (in promise) Error: Some services could not be started: mail_discuss_group_systray_service. Missing dependencies: messaging
_startServices env.js:156
startServices env.js:85
startWebClient start.js:33
startPosApp main.js:33
main.js:36
def boot.js:128
processJob boot.js:126
processJobs boot.js:197
def boot.js:138
promise callbackprocessJobs/processJob/def< boot.js:135
processJob boot.js:126
processJobs boot.js:197
def boot.js:138
promise callback
processJobs/processJob/def< boot.js:135
processJob boot.js:126
processJobs boot.js:197
define boot.js:254
point_of_sale.assets_backend_prod_only.js:236
env.js:156
start error_service.js:127
AsyncFunctionThrow self-hosted:811
(Asynchrone : async)
start error_service.js:119
start env.js:111
_startServices env.js:142
startServices env.js:85
InterpretGeneratorResume self-hosted:1420
AsyncFunctionNext self-hosted:807
(Asynchrone : async)
startWebClient start.js:33
startPosApp main.js:33
main.js:36
def boot.js:128
processJob boot.js:126
processJobs boot.js:197
def boot.js:138
(Asynchrone : promise callback)
def boot.js:135
processJob boot.js:126
processJobs boot.js:197
def boot.js:138
(Asynchrone : promise callback)
def boot.js:135
processJob boot.js:126
processJobs boot.js:197
define boot.js:254
point_of_sale.assets_backend_prod_only.js:236

I'm pretty lost. I introduced the asset in web.assets_backend bundle. So, If I understand correctly, this bundle is not loaded in the point of sale, so error should not occures.
Ref : doc : https://www.odoo.com/documentation/17.0/fr/developer/reference/frontend/assets.html#bundles

  • the systray_service.js file looks like the original one. The original file is introduced in the web.assets_backend bundle in the mail manifest file.

@OCA/web-maintainers : Any help welcome !

Thanks !

@pedrobaeza
Copy link
Member

Existing a model called mail.group, the module name is misleading. I think it should be called mail_discuss_security.

@legalsylvain
Copy link
Contributor Author

Existing a model called mail.group, the module name is misleading. I think it should be called mail_discuss_security.

agree ! _security is indeed a common suffix for such feature.

@legalsylvain legalsylvain changed the title [ADD] New module mail_discuss_group to hide 'Discuss' Application by default [ADD] New module mail_discuss_security to hide 'Discuss' Application by default Sep 27, 2024
@tarteo
Copy link
Member

tarteo commented Oct 1, 2024

@legalsylvain where is the messaging service defined? Perhaps you're missing a dependency in you manifest

Edit:
Found it (it's in mail)
Do you still get the error if you add the line import { messagingService } from '@mail/services/messaging_service'; to your file? I know it's stupid but I want to rule out if it's a load order issue (I doubt it but still)

@legalsylvain
Copy link
Contributor Author

hi @tarteo. Thanks for your review. In fact I updated my comment, with UPDATE : removing the line - dependencies: ["messaging"], looks to fix the problem. because I found the problem. I just remove the dependency to "messaging", and it work.
sorry if you lost time to investigate.

At this step, this PR is ready to review and to be merged.

Copy link
Member

@tarteo tarteo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@legalsylvain No problem, just tested it and it works!

@legalsylvain
Copy link
Contributor Author

4 approvals.
Let'go !

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

Sorry @legalsylvain you are not allowed to merge.

To do so you must either have push permissions on the repository, or be a declared maintainer of all modified addons.

If you wish to adopt an addon and become it's maintainer, open a pull request to add your GitHub login to the maintainers key of its manifest.

@hbrunn
Copy link
Member

hbrunn commented Oct 1, 2024

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 16.0-ocabot-merge-pr-1423-by-hbrunn-bump-nobump, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit d7d4151 into OCA:16.0 Oct 1, 2024
9 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at aba043a. Thanks a lot for contributing to OCA. ❤️

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

Successfully merging this pull request may close these issues.

7 participants