odoo-addon-mail-gateway 16.0.1.3.0__py3-none-any.whl → 18.0.1.0.0.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of odoo-addon-mail-gateway might be problematic. Click here for more details.

Files changed (100) hide show
  1. odoo/addons/mail_gateway/README.rst +41 -24
  2. odoo/addons/mail_gateway/__init__.py +1 -1
  3. odoo/addons/mail_gateway/__manifest__.py +7 -14
  4. odoo/addons/mail_gateway/controllers/__init__.py +0 -1
  5. odoo/addons/mail_gateway/controllers/gateway.py +5 -2
  6. odoo/addons/mail_gateway/hooks.py +3 -3
  7. odoo/addons/mail_gateway/i18n/es.po +68 -406
  8. odoo/addons/mail_gateway/i18n/it.po +5 -336
  9. odoo/addons/mail_gateway/i18n/mail_gateway.pot +140 -121
  10. odoo/addons/mail_gateway/models/__init__.py +4 -3
  11. odoo/addons/mail_gateway/models/{mail_channel.py → discuss_channel.py} +45 -17
  12. odoo/addons/mail_gateway/models/ir_websocket.py +1 -1
  13. odoo/addons/mail_gateway/models/mail_gateway.py +8 -8
  14. odoo/addons/mail_gateway/models/mail_gateway_abstract.py +3 -3
  15. odoo/addons/mail_gateway/models/mail_guest.py +6 -4
  16. odoo/addons/mail_gateway/models/mail_message.py +40 -21
  17. odoo/addons/mail_gateway/models/mail_notification.py +15 -8
  18. odoo/addons/mail_gateway/models/mail_thread.py +56 -10
  19. odoo/addons/mail_gateway/models/res_partner.py +10 -32
  20. odoo/addons/mail_gateway/models/res_users.py +3 -4
  21. odoo/addons/mail_gateway/models/res_users_settings.py +12 -0
  22. odoo/addons/mail_gateway/readme/CONTRIBUTORS.md +5 -0
  23. odoo/addons/mail_gateway/readme/{CREDITS.rst → CREDITS.md} +2 -1
  24. odoo/addons/mail_gateway/readme/DESCRIPTION.md +8 -0
  25. odoo/addons/mail_gateway/readme/ROADMAP.md +1 -0
  26. odoo/addons/mail_gateway/readme/USAGE.md +12 -0
  27. odoo/addons/mail_gateway/security/ir.model.access.csv +4 -2
  28. odoo/addons/mail_gateway/security/security.xml +9 -10
  29. odoo/addons/mail_gateway/static/description/index.html +46 -28
  30. odoo/addons/mail_gateway/static/src/components/chatter/chatter.esm.js +14 -0
  31. odoo/addons/mail_gateway/static/src/components/chatter/chatter.xml +42 -22
  32. odoo/addons/mail_gateway/static/src/components/composer/composer.esm.js +107 -0
  33. odoo/addons/mail_gateway/static/src/components/gateway_follower/gateway_follower.esm.js +35 -23
  34. odoo/addons/mail_gateway/static/src/components/gateway_follower/gateway_follower.xml +3 -5
  35. odoo/addons/mail_gateway/static/src/components/message/message.xml +15 -15
  36. odoo/addons/mail_gateway/static/src/components/message/message_patch.esm.js +67 -0
  37. odoo/addons/mail_gateway/static/src/components/message_notification_popover_content/message_notification_popover_content.xml +3 -7
  38. odoo/addons/mail_gateway/static/src/core/common/composer_model_patch.esm.js +22 -0
  39. odoo/addons/mail_gateway/static/src/core/common/discuss_app_model_patch.esm.js +25 -0
  40. odoo/addons/mail_gateway/static/src/core/common/mail_composer_send_dropdown.esm.js +27 -0
  41. odoo/addons/mail_gateway/static/src/core/common/mail_composer_send_dropdown.xml +15 -0
  42. odoo/addons/mail_gateway/static/src/core/common/message_actions.esm.js +25 -0
  43. odoo/addons/mail_gateway/static/src/core/common/message_model_patch.esm.js +25 -0
  44. odoo/addons/mail_gateway/static/src/core/common/notification_model_patch.esm.js +34 -0
  45. odoo/addons/mail_gateway/static/src/core/common/persona_model_patch.esm.js +10 -0
  46. odoo/addons/mail_gateway/static/src/core/common/store_service_patch.esm.js +18 -0
  47. odoo/addons/mail_gateway/static/src/core/common/thread_model_patch.esm.js +54 -0
  48. odoo/addons/mail_gateway/static/src/core/web/discuss_app_category_model_patch.esm.js +19 -0
  49. odoo/addons/mail_gateway/static/src/core/web/discuss_sidebar_category_item_patch.xml +16 -0
  50. odoo/addons/mail_gateway/static/src/core/web/gateway_core_web_service.esm.js +36 -0
  51. odoo/addons/mail_gateway/static/src/models/gateway.esm.js +21 -15
  52. odoo/addons/mail_gateway/static/src/models/gateway_channel.esm.js +20 -13
  53. odoo/addons/mail_gateway/static/src/models/gateway_follower.esm.js +23 -0
  54. odoo/addons/mail_gateway/tools/__init__.py +1 -0
  55. odoo/addons/mail_gateway/tools/discuss.py +16 -0
  56. odoo/addons/mail_gateway/views/mail_gateway.xml +7 -7
  57. odoo/addons/mail_gateway/views/mail_guest_views.xml +15 -0
  58. odoo/addons/mail_gateway/views/res_partner_gateway_channel.xml +3 -4
  59. odoo/addons/mail_gateway/views/res_users_settings_views.xml +12 -0
  60. odoo/addons/mail_gateway/wizards/mail_compose_gateway_message.py +19 -4
  61. odoo/addons/mail_gateway/wizards/mail_compose_gateway_message.xml +2 -7
  62. odoo/addons/mail_gateway/wizards/mail_guest_manage.py +2 -3
  63. odoo/addons/mail_gateway/wizards/mail_guest_manage.xml +2 -6
  64. odoo/addons/mail_gateway/wizards/mail_message_gateway_link.py +3 -6
  65. odoo/addons/mail_gateway/wizards/mail_message_gateway_link.xml +0 -2
  66. odoo/addons/mail_gateway/wizards/mail_message_gateway_send.py +0 -1
  67. odoo/addons/mail_gateway/wizards/mail_message_gateway_send.xml +0 -4
  68. {odoo_addon_mail_gateway-16.0.1.3.0.dist-info → odoo_addon_mail_gateway-18.0.1.0.0.3.dist-info}/METADATA +48 -30
  69. odoo_addon_mail_gateway-18.0.1.0.0.3.dist-info/RECORD +77 -0
  70. {odoo_addon_mail_gateway-16.0.1.3.0.dist-info → odoo_addon_mail_gateway-18.0.1.0.0.3.dist-info}/WHEEL +1 -1
  71. odoo_addon_mail_gateway-18.0.1.0.0.3.dist-info/top_level.txt +1 -0
  72. odoo/addons/mail_gateway/controllers/discuss.py +0 -11
  73. odoo/addons/mail_gateway/i18n/es_VE.po +0 -879
  74. odoo/addons/mail_gateway/readme/CONTRIBUTORS.rst +0 -2
  75. odoo/addons/mail_gateway/readme/DESCRIPTION.rst +0 -5
  76. odoo/addons/mail_gateway/readme/USAGE.rst +0 -9
  77. odoo/addons/mail_gateway/static/src/components/composer/composer.xml +0 -24
  78. odoo/addons/mail_gateway/static/src/components/discuss_sidebar/discuss_sidebar.xml +0 -17
  79. odoo/addons/mail_gateway/static/src/models/channel.esm.js +0 -33
  80. odoo/addons/mail_gateway/static/src/models/channel_member_view.esm.js +0 -39
  81. odoo/addons/mail_gateway/static/src/models/chatter.esm.js +0 -41
  82. odoo/addons/mail_gateway/static/src/models/composer.esm.js +0 -32
  83. odoo/addons/mail_gateway/static/src/models/composer_gateway_follower.esm.js +0 -32
  84. odoo/addons/mail_gateway/static/src/models/composer_view.esm.js +0 -103
  85. odoo/addons/mail_gateway/static/src/models/discuss.esm.js +0 -51
  86. odoo/addons/mail_gateway/static/src/models/discuss_sidebar_category.esm.js +0 -128
  87. odoo/addons/mail_gateway/static/src/models/discuss_sidebar_category_item.esm.js +0 -51
  88. odoo/addons/mail_gateway/static/src/models/gateway_channel_view.esm.js +0 -15
  89. odoo/addons/mail_gateway/static/src/models/guest.esm.js +0 -10
  90. odoo/addons/mail_gateway/static/src/models/message.esm.js +0 -76
  91. odoo/addons/mail_gateway/static/src/models/message_action.esm.js +0 -45
  92. odoo/addons/mail_gateway/static/src/models/message_action_list.esm.js +0 -37
  93. odoo/addons/mail_gateway/static/src/models/message_action_view.esm.js +0 -91
  94. odoo/addons/mail_gateway/static/src/models/message_view.esm.js +0 -13
  95. odoo/addons/mail_gateway/static/src/models/messaging_initializer.esm.js +0 -24
  96. odoo/addons/mail_gateway/static/src/models/notification.esm.js +0 -20
  97. odoo/addons/mail_gateway/static/src/models/partner.esm.js +0 -11
  98. odoo/addons/mail_gateway/static/src/models/thread.esm.js +0 -77
  99. odoo_addon_mail_gateway-16.0.1.3.0.dist-info/RECORD +0 -78
  100. odoo_addon_mail_gateway-16.0.1.3.0.dist-info/top_level.txt +0 -1
@@ -372,67 +372,85 @@ ul.auto-toc {
372
372
  !! This file is generated by oca-gen-addon-readme !!
373
373
  !! changes will be overwritten. !!
374
374
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
375
- !! source digest: sha256:cff2294334d6db807a724770b407b9c0b280e14970058bf4415703b93038290b
375
+ !! source digest: sha256:568a6781f64a53a5752bbccddcce93fffe6b683c77cb5717a30264cfab6068b9
376
376
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
377
- <p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/social/tree/16.0/mail_gateway"><img alt="OCA/social" src="https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/social-16-0/social-16-0-mail_gateway"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/social&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
378
- <p>This module will allow you to integrate an external chat system in your Odoo system.
379
- It requires extra modules with the specific configuration of each chat system, like <cite>mail_gateway_telegram</cite> or <cite>mail_gateway_whatsapp</cite>.</p>
380
- <p>This way, a group of users can respond customers or any other set
381
- of partners within Odoo, but the messages will be sent through the external chat system.</p>
377
+ <p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/social/tree/18.0/mail_gateway"><img alt="OCA/social" src="https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/social-18-0/social-18-0-mail_gateway"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/social&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
378
+ <p>This module will allow you to integrate an external chat system in your
379
+ Odoo system. It requires extra modules with the specific configuration
380
+ of each chat system, like mail_gateway_telegram or
381
+ mail_gateway_whatsapp.</p>
382
+ <p>This way, a group of users can respond customers or any other set of
383
+ partners within Odoo, but the messages will be sent through the external
384
+ chat system.</p>
382
385
  <p><strong>Table of contents</strong></p>
383
386
  <div class="contents local topic" id="contents">
384
387
  <ul class="simple">
385
388
  <li><a class="reference internal" href="#usage" id="toc-entry-1">Usage</a></li>
386
- <li><a class="reference internal" href="#bug-tracker" id="toc-entry-2">Bug Tracker</a></li>
387
- <li><a class="reference internal" href="#credits" id="toc-entry-3">Credits</a><ul>
388
- <li><a class="reference internal" href="#authors" id="toc-entry-4">Authors</a></li>
389
- <li><a class="reference internal" href="#contributors" id="toc-entry-5">Contributors</a></li>
390
- <li><a class="reference internal" href="#other-credits" id="toc-entry-6">Other credits</a></li>
391
- <li><a class="reference internal" href="#maintainers" id="toc-entry-7">Maintainers</a></li>
389
+ <li><a class="reference internal" href="#known-issues-roadmap" id="toc-entry-2">Known issues / Roadmap</a></li>
390
+ <li><a class="reference internal" href="#bug-tracker" id="toc-entry-3">Bug Tracker</a></li>
391
+ <li><a class="reference internal" href="#credits" id="toc-entry-4">Credits</a><ul>
392
+ <li><a class="reference internal" href="#authors" id="toc-entry-5">Authors</a></li>
393
+ <li><a class="reference internal" href="#contributors" id="toc-entry-6">Contributors</a></li>
394
+ <li><a class="reference internal" href="#other-credits" id="toc-entry-7">Other credits</a></li>
395
+ <li><a class="reference internal" href="#maintainers" id="toc-entry-8">Maintainers</a></li>
392
396
  </ul>
393
397
  </li>
394
398
  </ul>
395
399
  </div>
396
400
  <div class="section" id="usage">
397
401
  <h2><a class="toc-backref" href="#toc-entry-1">Usage</a></h2>
398
- <p>When external messages are received, they will be directly sent to the discuss menu.
399
- Answering to these messages will send the answer to the external contact.
400
- We can assign this messages to any record using the message actions.
401
- Also, we can assign the sender to a partner using the followers menu and selecting the partner.</p>
402
- <p>On a standard record associated to a partner with external chat, we can send messages to the external contact directly selecting the methods of the partner.
403
- To use this, we just need to use the</p>
404
- <p>It is recomended to enable chatter notification to all users that will receive messages from gateways.</p>
402
+ <p>When external messages are received, they will be directly sent to the
403
+ discuss menu. Answering to these messages will send the answer to the
404
+ external contact. We can assign this messages to any record using the
405
+ message actions. Also, we can assign the sender to a partner using the
406
+ followers menu and selecting the partner.</p>
407
+ <p>On a standard record associated to a partner with external chat, we can
408
+ send messages to the external contact directly selecting the methods of
409
+ the partner. To use this, we just need to use the</p>
410
+ <p>It is recomended to enable chatter notification to all users that will
411
+ receive messages from gateways.</p>
412
+ </div>
413
+ <div class="section" id="known-issues-roadmap">
414
+ <h2><a class="toc-backref" href="#toc-entry-2">Known issues / Roadmap</a></h2>
415
+ <ol class="arabic simple">
416
+ <li>Make possible to schedule gateway messages.</li>
417
+ </ol>
405
418
  </div>
406
419
  <div class="section" id="bug-tracker">
407
- <h2><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h2>
420
+ <h2><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h2>
408
421
  <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/social/issues">GitHub Issues</a>.
409
422
  In case of trouble, please check there if your issue has already been reported.
410
423
  If you spotted it first, help us to smash it by providing a detailed and welcomed
411
- <a class="reference external" href="https://github.com/OCA/social/issues/new?body=module:%20mail_gateway%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
424
+ <a class="reference external" href="https://github.com/OCA/social/issues/new?body=module:%20mail_gateway%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
412
425
  <p>Do not contact contributors directly about support or help with technical issues.</p>
413
426
  </div>
414
427
  <div class="section" id="credits">
415
- <h2><a class="toc-backref" href="#toc-entry-3">Credits</a></h2>
428
+ <h2><a class="toc-backref" href="#toc-entry-4">Credits</a></h2>
416
429
  <div class="section" id="authors">
417
- <h3><a class="toc-backref" href="#toc-entry-4">Authors</a></h3>
430
+ <h3><a class="toc-backref" href="#toc-entry-5">Authors</a></h3>
418
431
  <ul class="simple">
419
432
  <li>Creu Blanca</li>
420
433
  <li>Dixmit</li>
421
434
  </ul>
422
435
  </div>
423
436
  <div class="section" id="contributors">
424
- <h3><a class="toc-backref" href="#toc-entry-5">Contributors</a></h3>
437
+ <h3><a class="toc-backref" href="#toc-entry-6">Contributors</a></h3>
425
438
  <ul class="simple">
426
439
  <li>Enric Tobella</li>
427
440
  <li>Olga Marco</li>
441
+ <li><a class="reference external" href="https://tecnativa.com">Tecnativa</a><ul>
442
+ <li>Carlos Roca</li>
443
+ </ul>
444
+ </li>
428
445
  </ul>
429
446
  </div>
430
447
  <div class="section" id="other-credits">
431
- <h3><a class="toc-backref" href="#toc-entry-6">Other credits</a></h3>
432
- <p>This work has been funded by AEOdoo (Asociación Española de Odoo - <a class="reference external" href="https://www.aeodoo.org">https://www.aeodoo.org</a>)</p>
448
+ <h3><a class="toc-backref" href="#toc-entry-7">Other credits</a></h3>
449
+ <p>This work has been funded by AEOdoo (Asociación Española de Odoo -
450
+ <a class="reference external" href="https://www.aeodoo.org">https://www.aeodoo.org</a>)</p>
433
451
  </div>
434
452
  <div class="section" id="maintainers">
435
- <h3><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h3>
453
+ <h3><a class="toc-backref" href="#toc-entry-8">Maintainers</a></h3>
436
454
  <p>This module is maintained by the OCA.</p>
437
455
  <a class="reference external image-reference" href="https://odoo-community.org">
438
456
  <img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
@@ -440,7 +458,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
440
458
  <p>OCA, or the Odoo Community Association, is a nonprofit organization whose
441
459
  mission is to support the collaborative development of Odoo features and
442
460
  promote its widespread use.</p>
443
- <p>This module is part of the <a class="reference external" href="https://github.com/OCA/social/tree/16.0/mail_gateway">OCA/social</a> project on GitHub.</p>
461
+ <p>This module is part of the <a class="reference external" href="https://github.com/OCA/social/tree/18.0/mail_gateway">OCA/social</a> project on GitHub.</p>
444
462
  <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
445
463
  </div>
446
464
  </div>
@@ -0,0 +1,14 @@
1
+ import {Chatter} from "@mail/chatter/web_portal/chatter";
2
+ import {GatewayFollower} from "../gateway_follower/gateway_follower.esm";
3
+ import {patch} from "@web/core/utils/patch";
4
+
5
+ patch(Chatter, {
6
+ components: {...Chatter.components, GatewayFollower},
7
+ });
8
+
9
+ patch(Chatter.prototype, {
10
+ toggleComposer(mode = false) {
11
+ this.state.thread.composer.isGateway = mode === "gateway";
12
+ super.toggleComposer(mode);
13
+ },
14
+ });
@@ -3,38 +3,58 @@
3
3
 
4
4
  <t
5
5
  t-name="mail_gateway.ChatterTopbar"
6
- t-inherit="mail.ChatterTopbar"
6
+ t-inherit="mail.Chatter"
7
7
  t-inherit-mode="extension"
8
- owl="1"
9
8
  >
10
- <xpath
11
- expr="//button[hasclass('o_ChatterTopbar_buttonSendMessage')]"
12
- position="attributes"
13
- >
14
- <attribute name="t-att-class">{
15
- 'o-active btn-odoo': chatterTopbar.chatter.composerView and !chatterTopbar.chatter.composerView.composer.isLog and !chatterTopbar.chatter.composerView.composer.isGateway,
16
- 'btn-odoo': !chatterTopbar.chatter.composerView,
17
- 'btn-light': chatterTopbar.chatter.composerView and (chatterTopbar.chatter.composerView.composer.isLog or chatterTopbar.chatter.composerView.composer.isGateway),
18
- }</attribute>
19
- </xpath>
20
- <xpath
21
- expr="//button[hasclass('o_ChatterTopbar_buttonLogNote')]"
22
- position="after"
23
- >
9
+ <xpath expr="//button[hasclass('o-mail-Chatter-logNote')]" position="after">
24
10
  <button
25
- class="o_ChatterTopbar_button o_ChatterTopbar_buttonLogWhatsapp btn text-nowrap btn-light"
11
+ class="o-mail-Chatter-gateway btn text-nowrap me-1"
26
12
  type="button"
27
13
  t-att-class="{
28
- 'o-active btn-odoo': chatterTopbar.chatter.composerView and !chatterTopbar.chatter.composerView.composer.isLog and chatterTopbar.chatter.composerView.composer.isGateway,
29
- 'btn-odoo': !chatterTopbar.chatter.composerView,
30
- 'btn-light': !chatterTopbar.chatter.composerView or (chatterTopbar.chatter.composerView.composer.isLog or !chatterTopbar.chatter.composerView.composer.isGateway),
14
+ 'btn-primary active': state.composerType === 'gateway',
15
+ 'btn-secondary': state.composerType !== 'gateway',
16
+ 'my-2': !props.compactHeight
31
17
  }"
32
- t-att-disabled="!chatterTopbar.chatter.isTemporary and !chatterTopbar.chatter.hasWriteAccess"
33
- t-on-click="() => this.chatterTopbar.chatter.onClickGatewayMessage()"
18
+ t-on-click="() => this.toggleComposer('gateway')"
19
+ data-hotkey="shift+w"
34
20
  >
35
21
  <i class="fa fa-plane" role="img" aria-label="gateway" />
36
22
  <span> Gateway message</span>
37
23
  </button>
38
24
  </xpath>
25
+ <xpath
26
+ expr="//t[@t-if='state.composerType']/SuggestedRecipientsList"
27
+ position="before"
28
+ >
29
+ <t
30
+ t-if="state.composerType === 'gateway' and state.thread.gateway_followers.length"
31
+ >
32
+ <div
33
+ class="flex-shrink-0 px-3 pt-3 text-truncate small mb-2"
34
+ style="margin-left:48px"
35
+ >
36
+ <span class="fw-bold">To:</span>
37
+ <t
38
+ t-foreach="state.thread.gateway_followers"
39
+ t-as="gateway_follower"
40
+ t-key="gateway_follower.id"
41
+ >
42
+ <GatewayFollower
43
+ follower="gateway_follower"
44
+ composer="state.thread.composer"
45
+ />
46
+ </t>
47
+ </div>
48
+ </t>
49
+ <t t-set="type" t-value="type === 'gateway' ? 'gateway' : type" />
50
+ </xpath>
51
+ <xpath
52
+ expr="//t[@t-if='state.composerType']/SuggestedRecipientsList"
53
+ position="attributes"
54
+ >
55
+ <attribute
56
+ name="t-if"
57
+ >state.composerType !== 'note' and state.thread.recipients.length > 0 and state.composerType !== 'gateway'</attribute>
58
+ </xpath>
39
59
  </t>
40
60
  </templates>
@@ -0,0 +1,107 @@
1
+ import {Composer} from "@mail/core/common/composer";
2
+ import {_t} from "@web/core/l10n/translation";
3
+ import {patch} from "@web/core/utils/patch";
4
+ import {prettifyMessageContent} from "@mail/utils/common/format";
5
+
6
+ patch(Composer.prototype, {
7
+ get SEND_TEXT() {
8
+ if (this.props.type === "gateway" && !this.props.composer.message) {
9
+ return _t("Send gateway");
10
+ }
11
+ return super.SEND_TEXT;
12
+ },
13
+ get placeholder() {
14
+ if (
15
+ this.thread?.model !== "discuss.channel" &&
16
+ !this.props.placeholder &&
17
+ this.props.type === "gateway"
18
+ ) {
19
+ return _t("Send a message to a gateway...");
20
+ }
21
+ return super.placeholder;
22
+ },
23
+ get isSendButtonDisabled() {
24
+ const isSendButtonDisabled = super.isSendButtonDisabled;
25
+ if (this.props.type !== "gateway") {
26
+ return isSendButtonDisabled;
27
+ }
28
+ return isSendButtonDisabled || !this.thread?.gateway_notifications?.length;
29
+ },
30
+ onFocusin() {
31
+ super.onFocusin();
32
+ if (this.props.type !== "gateway") {
33
+ this.thread.gateway_notifications = [];
34
+ }
35
+ },
36
+ async onClickFullComposer() {
37
+ if (this.props.type !== "gateway") {
38
+ return super.onClickFullComposer(...arguments);
39
+ }
40
+ const attachmentIds = this.props.composer.attachments.map(
41
+ (attachment) => attachment.id
42
+ );
43
+ const body = this.props.composer.textInputContent;
44
+ const validMentions = this.store.user
45
+ ? this.messageService.getMentionsFromText(body, {
46
+ mentionedChannels: this.props.composer.mentionedChannels,
47
+ mentionedPartners: this.props.composer.mentionedPartners,
48
+ })
49
+ : undefined;
50
+ // Debugger
51
+ const context = {
52
+ default_attachment_ids: attachmentIds,
53
+ default_body: await prettifyMessageContent(body, validMentions),
54
+ default_model: this.thread.model,
55
+ default_partner_ids: this.thread.suggestedRecipients
56
+ .filter((recipient) => recipient.checked)
57
+ .map((recipient) => recipient.persona.id),
58
+ default_res_ids: [this.thread.id],
59
+ default_subtype_xmlid: "mail.mt_comment",
60
+ mail_post_autofollow: this.thread.hasWriteAccess,
61
+ default_wizard_partner_ids: Array.from(
62
+ new Set(
63
+ this.thread.gateway_followers.map((follower) => {
64
+ return follower.id;
65
+ })
66
+ )
67
+ ),
68
+ default_wizard_channel_ids: Array.from(
69
+ new Set(
70
+ this.thread.gateway_followers
71
+ .map((follower) => {
72
+ return follower.gateway_channels.map(
73
+ (channel) => channel?.id
74
+ );
75
+ })
76
+ .flat()
77
+ )
78
+ ),
79
+ };
80
+ const action = {
81
+ name: _t("Gateway message"),
82
+ type: "ir.actions.act_window",
83
+ res_model: "mail.compose.gateway.message",
84
+ view_mode: "form",
85
+ views: [[false, "form"]],
86
+ target: "new",
87
+ context: context,
88
+ };
89
+ const options = {
90
+ onClose: (...args) => {
91
+ // Args === [] : click on 'X'
92
+ // args === { special: true } : click on 'discard'
93
+ const isDiscard = args.length === 0 || args[0]?.special;
94
+ // Otherwise message is posted (args === [undefined])
95
+ if (!isDiscard && this.props.composer.thread.type === "mailbox") {
96
+ this.notifySendFromMailbox();
97
+ }
98
+ this.clear();
99
+ this.props.messageToReplyTo?.cancel();
100
+ if (this.thread) {
101
+ this.thread?.fetchNewMessages();
102
+ }
103
+ },
104
+ };
105
+ await this.env.services.action.doAction(action, options);
106
+ },
107
+ });
@@ -1,31 +1,43 @@
1
- /** @odoo-module **/
1
+ import {Component} from "@odoo/owl";
2
2
 
3
- import {registerMessagingComponent} from "@mail/utils/messaging_component";
4
- import {useComponentToModel} from "@mail/component_hooks/use_component_to_model";
5
-
6
- const {Component} = owl;
7
-
8
- class GatewayFollowerView extends Component {
9
- /**
10
- * @override
11
- */
3
+ export class GatewayFollower extends Component {
4
+ static template = "mail_gateway.GatewayFollowerView";
5
+ static props = ["follower", "composer"];
12
6
  setup() {
13
- super.setup();
14
- useComponentToModel({fieldName: "component"});
7
+ this.channel = false;
8
+ this.follower_channel_ids = this.props.follower.gateway_channels.map(
9
+ (channel) => channel.id
10
+ );
11
+ this._clearGatewayNotifications();
15
12
  }
16
13
  get composerGatewayFollower() {
17
- return this.props.record;
14
+ return this.props.follower;
15
+ }
16
+ _getMessageData() {
17
+ return {
18
+ partner_id: this.props.follower.id,
19
+ channel_type: "gateway",
20
+ gateway_channel_id: this.channel,
21
+ };
22
+ }
23
+ _clearGatewayNotifications() {
24
+ this.props.composer.thread.gateway_notifications =
25
+ this.props.composer.thread.gateway_notifications.filter(
26
+ (gateway_notification) => {
27
+ return !this.follower_channel_ids.includes(
28
+ gateway_notification.gateway_channel_id
29
+ );
30
+ }
31
+ );
18
32
  }
19
33
  onChangeGatewayChannel(ev) {
20
- this.props.record.update({
21
- channel: parseInt(ev.target.options[ev.target.selectedIndex].value, 10),
22
- });
34
+ this.channel = parseInt(ev.target.options[ev.target.selectedIndex].value, 10);
35
+ if (this.channel) {
36
+ this.props.composer.thread.gateway_notifications.push(
37
+ this._getMessageData()
38
+ );
39
+ } else {
40
+ this._clearGatewayNotifications();
41
+ }
23
42
  }
24
43
  }
25
-
26
- Object.assign(GatewayFollowerView, {
27
- props: {record: Object},
28
- template: "mail_gateway.GatewayFollowerView",
29
- });
30
-
31
- registerMessagingComponent(GatewayFollowerView);
@@ -1,27 +1,25 @@
1
1
  <?xml version="1.0" encoding="UTF-8" ?>
2
2
  <templates xml:space="preserve">
3
- <t t-name="mail_gateway.GatewayFollowerView" owl="1">
3
+ <t t-name="mail_gateway.GatewayFollowerView">
4
4
  <div class="o_gateway_composer_selector">
5
5
  <span
6
6
  class="o_gateway_composer_selector_partner"
7
- t-esc="composerGatewayFollower.follower.partner.persona.name"
7
+ t-esc="composerGatewayFollower.name"
8
8
  />
9
9
  <select
10
10
  name="gatewayChannel"
11
11
  class="o_input o_gateway_composer_selector_channel"
12
- t-att-value="composerGatewayFollower.channel"
13
12
  t-on-change="onChangeGatewayChannel"
14
13
  >
15
14
  <option value="">Not selected</option>
16
15
  <t
17
- t-foreach="composerGatewayFollower.follower.partner.gateway_channels"
16
+ t-foreach="composerGatewayFollower.gateway_channels"
18
17
  t-as="gateway_channel"
19
18
  t-key="gateway_channel.id"
20
19
  >
21
20
  <option
22
21
  t-att-value="gateway_channel.id"
23
22
  t-esc="gateway_channel.name"
24
- t-att-selected="gateway_channel.id === composerGatewayFollower.channel"
25
23
  />
26
24
  </t>
27
25
  </select>
@@ -2,21 +2,21 @@
2
2
  <templates xml:space="preserve">
3
3
 
4
4
  <t t-inherit="mail.Message" t-inherit-mode="extension">
5
- <xpath expr="//small[hasclass('o_Message_originThread')]/.." position="after">
6
- <t t-if="messageView.message.gatewayThread">
7
- <small
8
- class="o_Message_originThread me-2"
9
- t-att-class="{ 'o-message-selected text-600': messageView.isSelected, 'text-500': !messageView.isSelected }"
10
- >
11
- on <a
12
- class="o_Message_originThreadLink fs-6"
13
- t-att-href="messageView.message.gatewayThread.url"
14
- t-on-click="messageView.onClickGatewayThread"
15
- ><t t-if="messageView.message.gatewayThread.displayName"><t
16
- t-esc="messageView.message.gatewayThread.displayName"
17
- /></t><t t-else="">document</t></a>
18
- </small>
19
- </t>
5
+ <xpath
6
+ expr="//small[@t-if='isPersistentMessageFromAnotherThread']"
7
+ position="after"
8
+ >
9
+ <small
10
+ t-if="message.gateway_thread_data"
11
+ t-on-click.prevent="openGatewayThreadRecord"
12
+ class="ms-1 text-500"
13
+ >
14
+ <t t-if="message.gateway_thread_data.model !== 'discuss.channel'">
15
+ on <a t-att-href="message.resUrl">
16
+ <t t-esc="message.gateway_thread_data?.name" />
17
+ </a>
18
+ </t>
19
+ </small>
20
20
  </xpath>
21
21
  </t>
22
22
  </templates>
@@ -0,0 +1,67 @@
1
+ import {Message} from "@mail/core/common/message";
2
+ import {_t} from "@web/core/l10n/translation";
3
+ import {patch} from "@web/core/utils/patch";
4
+
5
+ patch(Message.prototype, {
6
+ hasAuthorClickable() {
7
+ if (
8
+ this.message.gateway_type &&
9
+ this.message.author?.type === "guest" &&
10
+ this.message.author.id
11
+ ) {
12
+ return true;
13
+ }
14
+ return super.hasAuthorClickable();
15
+ },
16
+ getAuthorText() {
17
+ if (this.hasAuthorClickable() && this.message.gateway_type) {
18
+ return _t("Create partner");
19
+ }
20
+ return super.getAuthorText();
21
+ },
22
+ onClickAuthor(ev) {
23
+ if (this.message.gateway_type && this.hasAuthorClickable()) {
24
+ ev.stopPropagation();
25
+ return this.env.services.action.doAction({
26
+ name: _t("Manage guest"),
27
+ type: "ir.actions.act_window",
28
+ res_model: "mail.guest.manage",
29
+ context: {default_guest_id: this.message.author.id},
30
+ views: [[false, "form"]],
31
+ target: "new",
32
+ });
33
+ }
34
+ return super.onClickAuthor(...arguments);
35
+ },
36
+ onClickLinkGatewayToThread() {
37
+ this.env.services.action.doAction({
38
+ name: _t("Link Message to thread"),
39
+ type: "ir.actions.act_window",
40
+ res_model: "mail.message.gateway.link",
41
+ context: {default_message_id: this.message.id},
42
+ views: [[false, "form"]],
43
+ target: "new",
44
+ });
45
+ },
46
+ onClickSendWithGateway() {
47
+ this.env.services.action.doAction({
48
+ name: _t("Send with gateway"),
49
+ type: "ir.actions.act_window",
50
+ res_model: "mail.message.gateway.send",
51
+ context: {
52
+ ...this.props.message.gateway_channel_data,
53
+ default_message_id: this.props.message.id,
54
+ },
55
+ views: [[false, "form"]],
56
+ target: "new",
57
+ });
58
+ },
59
+ openGatewayThreadRecord() {
60
+ this.store.env.services.action.doAction({
61
+ type: "ir.actions.act_window",
62
+ res_id: this.message.gateway_thread_data.id,
63
+ res_model: this.message.gateway_thread_data.model,
64
+ views: [[false, "form"]],
65
+ });
66
+ },
67
+ });
@@ -1,14 +1,10 @@
1
1
  <?xml version="1.0" encoding="UTF-8" ?>
2
2
  <templates xml:space="preserve">
3
- <t t-inherit="mail.MessageNotificationPopoverContent" t-inherit-mode="extension">
4
- <xpath
5
- expr="//div[hasclass('o_MessageNotificationPopoverContent_notification')]"
6
- position="inside"
7
- >
3
+ <t t-inherit="mail.MessageNotificationPopover" t-inherit-mode="extension">
4
+ <xpath expr="//span[@t-if='notification.persona']" position="after">
8
5
  <span
9
- class="o_MessageNotificationPopoverContent_notificationPartnerName"
6
+ t-elif="notification.notification_type == 'gateway'"
10
7
  t-esc="notification.channel_name"
11
- t-if="notification.notification_type == 'gateway'"
12
8
  />
13
9
  </xpath>
14
10
  </t>
@@ -0,0 +1,22 @@
1
+ import {Composer} from "@mail/core/common/composer_model";
2
+ import {patch} from "@web/core/utils/patch";
3
+ import {url} from "@web/core/utils/urls";
4
+
5
+ patch(Composer, {
6
+ get resUrl() {
7
+ if (!this.gateway_thread_data) {
8
+ return super.resUrl;
9
+ }
10
+ return `${url("/web")}#model=${this.gateway_thread_data.model}&id=${
11
+ this.gateway_thread_data.id
12
+ }`;
13
+ },
14
+ });
15
+
16
+ patch(Composer.prototype, {
17
+ setup() {
18
+ super.setup();
19
+ this.gateway_channel = false;
20
+ this.gateway_partner = false;
21
+ },
22
+ });
@@ -0,0 +1,25 @@
1
+ import {DiscussApp} from "@mail/core/public_web/discuss_app_model";
2
+ import {Record} from "@mail/core/common/record";
3
+
4
+ import {_t} from "@web/core/l10n/translation";
5
+ import {patch} from "@web/core/utils/patch";
6
+
7
+ patch(DiscussApp.prototype, {
8
+ setup(env) {
9
+ super.setup(env);
10
+ this.gateway = Record.one("DiscussAppCategory", {
11
+ compute() {
12
+ return {
13
+ extraClass: "o-mail-DiscussSidebarCategory-gateway",
14
+ id: "gateway",
15
+ name: _t("Gateway"),
16
+ isOpen: false,
17
+ canView: false,
18
+ canAdd: true,
19
+ addTitle: _t("Search Gateway Channel"),
20
+ serverStateKey: "is_discuss_sidebar_category_gateway_open",
21
+ };
22
+ },
23
+ });
24
+ },
25
+ });
@@ -0,0 +1,27 @@
1
+ import "@mail/chatter/web/mail_composer_send_dropdown"; // <- side-effect
2
+ import {registry} from "@web/core/registry";
3
+ import {patch} from "@web/core/utils/patch";
4
+
5
+ const def = registry.category("view_widgets").get("mail_composer_send_dropdown");
6
+ const MailComposerSendDropdownClass = def.component;
7
+
8
+ patch(MailComposerSendDropdownClass.prototype, {
9
+ async onClickSend() {
10
+ const model = this.env.model.config.resModel;
11
+ if (model === "mail.compose.message") {
12
+ return await super.onClickSend(...arguments);
13
+ }
14
+ this.buttonState.disabled = true;
15
+ if (await this.props.record.save()) {
16
+ const method = this.props.record.data.scheduled_date
17
+ ? "action_schedule_message"
18
+ : "action_send_mail";
19
+ this.actionService.doAction(
20
+ await this.orm.call(model, method, [this.props.record.resId], {
21
+ context: this.props.record.context,
22
+ })
23
+ );
24
+ }
25
+ this.buttonState.disabled = false;
26
+ },
27
+ });