odoo-addon-mail-gateway-whatsapp 16.0.1.1.0.6__py3-none-any.whl → 17.0.1.0.0.2__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.
Files changed (42) hide show
  1. odoo/addons/mail_gateway_whatsapp/README.rst +61 -45
  2. odoo/addons/mail_gateway_whatsapp/__manifest__.py +2 -6
  3. odoo/addons/mail_gateway_whatsapp/i18n/es.po +0 -10
  4. odoo/addons/mail_gateway_whatsapp/i18n/it.po +3 -13
  5. odoo/addons/mail_gateway_whatsapp/i18n/mail_gateway_whatsapp.pot +2 -23
  6. odoo/addons/mail_gateway_whatsapp/models/__init__.py +1 -1
  7. odoo/addons/mail_gateway_whatsapp/models/{mail_channel.py → discuss_channel.py} +5 -8
  8. odoo/addons/mail_gateway_whatsapp/models/mail_gateway_whatsapp.py +21 -33
  9. odoo/addons/mail_gateway_whatsapp/models/mail_thread.py +3 -7
  10. odoo/addons/mail_gateway_whatsapp/readme/CONFIGURE.md +35 -0
  11. odoo/addons/mail_gateway_whatsapp/readme/CONTRIBUTORS.md +7 -0
  12. odoo/addons/mail_gateway_whatsapp/readme/{CREDITS.rst → CREDITS.md} +2 -1
  13. odoo/addons/mail_gateway_whatsapp/readme/{DESCRIPTION.rst → DESCRIPTION.md} +2 -2
  14. odoo/addons/mail_gateway_whatsapp/readme/ROADMAP.md +4 -0
  15. odoo/addons/mail_gateway_whatsapp/readme/USAGE.md +3 -0
  16. odoo/addons/mail_gateway_whatsapp/static/description/index.html +55 -40
  17. odoo/addons/mail_gateway_whatsapp/static/src/components/message/message.xml +2 -2
  18. odoo/addons/mail_gateway_whatsapp/static/src/components/message/message_patch.esm.js +17 -0
  19. odoo/addons/mail_gateway_whatsapp/static/src/components/phone_field/phone_field.esm.js +1 -1
  20. odoo/addons/mail_gateway_whatsapp/static/src/components/phone_field/phone_field.xml +2 -2
  21. odoo/addons/mail_gateway_whatsapp/static/src/components/send_whatsapp_button/send_whatsapp_button.esm.js +3 -3
  22. odoo/addons/mail_gateway_whatsapp/tests/test_mail_gateway_whatsapp.py +10 -8
  23. odoo/addons/mail_gateway_whatsapp/tools/const.py +1 -1
  24. odoo/addons/mail_gateway_whatsapp/views/mail_gateway.xml +7 -10
  25. odoo/addons/mail_gateway_whatsapp/views/mail_whatsapp_template_views.xml +11 -26
  26. odoo/addons/mail_gateway_whatsapp/wizards/mail_compose_gateway_message.py +1 -3
  27. odoo/addons/mail_gateway_whatsapp/wizards/mail_compose_gateway_message.xml +2 -6
  28. odoo/addons/mail_gateway_whatsapp/wizards/whatsapp_composer.py +1 -2
  29. odoo/addons/mail_gateway_whatsapp/wizards/whatsapp_composer.xml +4 -11
  30. {odoo_addon_mail_gateway_whatsapp-16.0.1.1.0.6.dist-info → odoo_addon_mail_gateway_whatsapp-17.0.1.0.0.2.dist-info}/METADATA +69 -52
  31. odoo_addon_mail_gateway_whatsapp-17.0.1.0.0.2.dist-info/RECORD +46 -0
  32. {odoo_addon_mail_gateway_whatsapp-16.0.1.1.0.6.dist-info → odoo_addon_mail_gateway_whatsapp-17.0.1.0.0.2.dist-info}/WHEEL +1 -1
  33. odoo_addon_mail_gateway_whatsapp-17.0.1.0.0.2.dist-info/top_level.txt +1 -0
  34. odoo/addons/mail_gateway_whatsapp/readme/CONFIGURE.rst +0 -31
  35. odoo/addons/mail_gateway_whatsapp/readme/CONTRIBUTORS.rst +0 -5
  36. odoo/addons/mail_gateway_whatsapp/readme/ROADMAP.rst +0 -4
  37. odoo/addons/mail_gateway_whatsapp/readme/USAGE.rst +0 -3
  38. odoo/addons/mail_gateway_whatsapp/static/src/models/message.esm.js +0 -21
  39. odoo/addons/mail_gateway_whatsapp/static/src/models/message_view.esm.js +0 -25
  40. odoo/addons/mail_gateway_whatsapp/static/src/models/notification.esm.js +0 -25
  41. odoo_addon_mail_gateway_whatsapp-16.0.1.1.0.6.dist-info/RECORD +0 -48
  42. odoo_addon_mail_gateway_whatsapp-16.0.1.1.0.6.dist-info/top_level.txt +0 -1
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
5
  <meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
6
- <title>Mail Whatsapp Gateway</title>
6
+ <title>README.rst</title>
7
7
  <style type="text/css">
8
8
 
9
9
  /*
@@ -360,19 +360,24 @@ ul.auto-toc {
360
360
  </style>
361
361
  </head>
362
362
  <body>
363
- <div class="document" id="mail-whatsapp-gateway">
364
- <h1 class="title">Mail Whatsapp Gateway</h1>
363
+ <div class="document">
365
364
 
365
+
366
+ <a class="reference external image-reference" href="https://odoo-community.org/get-involved?utm_source=readme">
367
+ <img alt="Odoo Community Association" src="https://odoo-community.org/readme-banner-image" />
368
+ </a>
369
+ <div class="section" id="mail-whatsapp-gateway">
370
+ <h1>Mail Whatsapp Gateway</h1>
366
371
  <!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
367
372
  !! This file is generated by oca-gen-addon-readme !!
368
373
  !! changes will be overwritten. !!
369
374
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
370
- !! source digest: sha256:70475641a2c7498a1ee67811eadb397e33c33435cdd2efb8edce729026ad09c4
375
+ !! source digest: sha256:abc9cf8f5146c06cb1a2171d01ee1797a2f5a092bc0dd29c5e39106dadc14efd
371
376
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
372
- <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/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/social/tree/16.0/mail_gateway_whatsapp"><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_whatsapp"><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>
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/17.0/mail_gateway_whatsapp"><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-17-0/social-17-0-mail_gateway_whatsapp"><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=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
373
378
  <p>This module allows to respond whatsapp chats.</p>
374
- <p>This way, a group of users can respond customers or any other set
375
- of partners in an integrated way.</p>
379
+ <p>This way, a group of users can respond customers or any other set of
380
+ partners in an integrated way.</p>
376
381
  <p><strong>Table of contents</strong></p>
377
382
  <div class="contents local topic" id="contents">
378
383
  <ul class="simple">
@@ -394,76 +399,84 @@ of partners in an integrated way.</p>
394
399
  </ul>
395
400
  </div>
396
401
  <div class="section" id="configuration">
397
- <h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
402
+ <h2><a class="toc-backref" href="#toc-entry-1">Configuration</a></h2>
398
403
  <div class="section" id="first-steps">
399
- <h2><a class="toc-backref" href="#toc-entry-2">First steps</a></h2>
400
- <p>You need to create a WhatsApp Business Account (WABA), a Meta App and define a phone number.
401
- You can follow this <a class="reference external" href="https://developers.facebook.com/micro_site/url/?click_from_context_menu=true&amp;country=ES&amp;destination=https%3A%2F%2Fwww.facebook.com%2Fbusiness%2Fhelp%2F2087193751603668&amp;event_type=click&amp;last_nav_impression_id=0m3TRxrxOlly1eRmB&amp;max_percent_page_viewed=22&amp;max_viewport_height_px=1326&amp;max_viewport_width_px=2560&amp;orig_http_referrer=https%3A%2F%2Fdevelopers.facebook.com%2Fdocs%2Fwhatsapp%2Fcloud-api%2Fget-started-for-bsps%3Flocale%3Den_US&amp;orig_request_uri=https%3A%2F%2Fdevelopers.facebook.com%2Fajax%2Fpagelet%2Fgeneric.php%2FDeveloperNotificationsPayloadPagelet%3Ffb_dtsg_ag%3D--sanitized--%26data%3D%257B%2522businessUserID%2522%253Anull%252C%2522cursor%2522%253Anull%252C%2522length%2522%253A15%252C%2522clientRequestID%2522%253A%2522js_k6%2522%257D%26__usid%3D6-Trd7hi4itpm%253APrd7ifiub2tvy%253A0-Ard7g9twdm0p1-RV%253D6%253AF%253D%26locale%3Den_US%26jazoest%3D24920&amp;region=emea&amp;scrolled=false&amp;session_id=1jLoVJNU6iVMaw3ml&amp;site=developers">steps</a>.</p>
402
- <p>If you create a test Business Account, passwords will change every 24 hours.</p>
404
+ <h3><a class="toc-backref" href="#toc-entry-2">First steps</a></h3>
405
+ <p>You need to create a WhatsApp Business Account (WABA), a Meta App and
406
+ define a phone number. You can follow this
407
+ <a class="reference external" href="https://developers.facebook.com/micro_site/url/?click_from_context_menu=true&amp;country=ES&amp;destination=https%3A%2F%2Fwww.facebook.com%2Fbusiness%2Fhelp%2F2087193751603668&amp;event_type=click&amp;last_nav_impression_id=0m3TRxrxOlly1eRmB&amp;max_percent_page_viewed=22&amp;max_viewport_height_px=1326&amp;max_viewport_width_px=2560&amp;orig_http_referrer=https%3A%2F%2Fdevelopers.facebook.com%2Fdocs%2Fwhatsapp%2Fcloud-api%2Fget-started-for-bsps%3Flocale%3Den_US&amp;orig_request_uri=https%3A%2F%2Fdevelopers.facebook.com%2Fajax%2Fpagelet%2Fgeneric.php%2FDeveloperNotificationsPayloadPagelet%3Ffb_dtsg_ag%3D--sanitized--%26data%3D%257B%2522businessUserID%2522%253Anull%252C%2522cursor%2522%253Anull%252C%2522length%2522%253A15%252C%2522clientRequestID%2522%253A%2522js_k6%2522%257D%26__usid%3D6-Trd7hi4itpm%253APrd7ifiub2tvy%253A0-Ard7g9twdm0p1-RV%253D6%253AF%253D%26locale%3Den_US%26jazoest%3D24920&amp;region=emea&amp;scrolled=false&amp;session_id=1jLoVJNU6iVMaw3ml&amp;site=developers">steps</a>.</p>
408
+ <p>If you create a test Business Account, passwords will change every 24
409
+ hours.</p>
403
410
  <p>In order to make the webhook accessible, the system must be public.</p>
404
411
  </div>
405
412
  <div class="section" id="configure-the-gateway">
406
- <h2><a class="toc-backref" href="#toc-entry-3">Configure the gateway</a></h2>
407
- <p>Once you have created the Meta App, you need to add the gateway and webhook.
408
- In order to make it you must follow this steps:</p>
413
+ <h3><a class="toc-backref" href="#toc-entry-3">Configure the gateway</a></h3>
414
+ <p>Once you have created the Meta App, you need to add the gateway and
415
+ webhook. In order to make it you must follow this steps:</p>
409
416
  <ul class="simple">
410
- <li>Access <cite>Settings &gt; Emails &gt; Mail Gateway</cite></li>
411
- <li>Create a Gateway of type <cite>WhatsApp</cite></li>
417
+ <li>Access Settings &gt; Emails &gt; Mail Gateway</li>
418
+ <li>Create a Gateway of type WhatsApp</li>
412
419
  </ul>
420
+ <!-- -->
413
421
  <blockquote>
414
422
  <ul class="simple">
415
- <li>Use the Meta App authentication key as <cite>Token</cite> field</li>
416
- <li>Use the Meta App Phone Number ID as <cite>Whatsapp from Phone</cite> field</li>
417
- <li>Use the Meta Account Business ID as <cite>Whatsapp account</cite> field (only if you need sync templates)</li>
418
- <li>Write your own <cite>Webhook key</cite></li>
419
- <li>Use the Application Secret Key on <cite>Whatsapp Security Key</cite>. It will be used in order to validate the data</li>
420
- <li>Press the <cite>Integrate Webhook Key</cite>. In this case, it will not integrate it, we need to make it manually</li>
423
+ <li>Use the Meta App authentication key as Token field</li>
424
+ <li>Use the Meta App Phone Number ID as Whatsapp from Phone field</li>
425
+ <li>Use the Meta Account Business ID as Whatsapp account field (only if
426
+ you need sync templates)</li>
427
+ <li>Write your own Webhook key</li>
428
+ <li>Use the Application Secret Key on Whatsapp Security Key. It will be
429
+ used in order to validate the data</li>
430
+ <li>Press the Integrate Webhook Key. In this case, it will not
431
+ integrate it, we need to make it manually</li>
421
432
  <li>Copy the webhook URL</li>
422
433
  </ul>
423
434
  </blockquote>
424
435
  <ul class="simple">
425
- <li>Access <a class="reference external" href="https://developers.facebook.com/apps/">Facebook Apps website</a></li>
426
- <li>Access your App then <cite>Whatsapp &gt; Configuration</cite></li>
427
- <li>Create your webhook using your URL and put the Whatsapp Security Key as validation Key</li>
436
+ <li>Access <a class="reference external" href="https://developers.facebook.com/apps/">Facebook Apps
437
+ website</a></li>
438
+ <li>Access your App then Whatsapp &gt; Configuration</li>
439
+ <li>Create your webhook using your URL and put the Whatsapp Security Key
440
+ as validation Key</li>
428
441
  <li>Administer the Webhook and activate the messages webhook</li>
429
442
  </ul>
430
443
  </div>
431
444
  </div>
432
445
  <div class="section" id="usage">
433
- <h1><a class="toc-backref" href="#toc-entry-4">Usage</a></h1>
446
+ <h2><a class="toc-backref" href="#toc-entry-4">Usage</a></h2>
434
447
  <ol class="arabic simple">
435
- <li>Access <cite>Gateway</cite></li>
448
+ <li>Access Gateway</li>
436
449
  <li>Wait until someone starts a conversation.</li>
437
450
  <li>Now you will be able to respond and receive messages to this person.</li>
438
451
  </ol>
439
452
  </div>
440
453
  <div class="section" id="known-issues-roadmap">
441
- <h1><a class="toc-backref" href="#toc-entry-5">Known issues / Roadmap</a></h1>
454
+ <h2><a class="toc-backref" href="#toc-entry-5">Known issues / Roadmap</a></h2>
442
455
  <p><strong>WhatsApp templates</strong></p>
443
456
  <ul class="simple">
444
- <li>Add support for <cite>Variables</cite></li>
445
- <li>Add support for <cite>Buttons</cite></li>
457
+ <li>Add support for Variables</li>
458
+ <li>Add support for Buttons</li>
446
459
  </ul>
447
460
  </div>
448
461
  <div class="section" id="bug-tracker">
449
- <h1><a class="toc-backref" href="#toc-entry-6">Bug Tracker</a></h1>
462
+ <h2><a class="toc-backref" href="#toc-entry-6">Bug Tracker</a></h2>
450
463
  <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/social/issues">GitHub Issues</a>.
451
464
  In case of trouble, please check there if your issue has already been reported.
452
465
  If you spotted it first, help us to smash it by providing a detailed and welcomed
453
- <a class="reference external" href="https://github.com/OCA/social/issues/new?body=module:%20mail_gateway_whatsapp%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
466
+ <a class="reference external" href="https://github.com/OCA/social/issues/new?body=module:%20mail_gateway_whatsapp%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
454
467
  <p>Do not contact contributors directly about support or help with technical issues.</p>
455
468
  </div>
456
469
  <div class="section" id="credits">
457
- <h1><a class="toc-backref" href="#toc-entry-7">Credits</a></h1>
470
+ <h2><a class="toc-backref" href="#toc-entry-7">Credits</a></h2>
458
471
  <div class="section" id="authors">
459
- <h2><a class="toc-backref" href="#toc-entry-8">Authors</a></h2>
472
+ <h3><a class="toc-backref" href="#toc-entry-8">Authors</a></h3>
460
473
  <ul class="simple">
461
474
  <li>Creu Blanca</li>
462
475
  <li>Dixmit</li>
463
476
  </ul>
464
477
  </div>
465
478
  <div class="section" id="contributors">
466
- <h2><a class="toc-backref" href="#toc-entry-9">Contributors</a></h2>
479
+ <h3><a class="toc-backref" href="#toc-entry-9">Contributors</a></h3>
467
480
  <ul>
468
481
  <li><p class="first">Olga Marco &lt;<a class="reference external" href="mailto:olga.marco&#64;creublanca.es">olga.marco&#64;creublanca.es</a>&gt;</p>
469
482
  </li>
@@ -479,11 +492,12 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
479
492
  </ul>
480
493
  </div>
481
494
  <div class="section" id="other-credits">
482
- <h2><a class="toc-backref" href="#toc-entry-10">Other credits</a></h2>
483
- <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>
495
+ <h3><a class="toc-backref" href="#toc-entry-10">Other credits</a></h3>
496
+ <p>This work has been funded by AEOdoo (Asociación Española de Odoo -
497
+ <a class="reference external" href="https://www.aeodoo.org">https://www.aeodoo.org</a>)</p>
484
498
  </div>
485
499
  <div class="section" id="maintainers">
486
- <h2><a class="toc-backref" href="#toc-entry-11">Maintainers</a></h2>
500
+ <h3><a class="toc-backref" href="#toc-entry-11">Maintainers</a></h3>
487
501
  <p>This module is maintained by the OCA.</p>
488
502
  <a class="reference external image-reference" href="https://odoo-community.org">
489
503
  <img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
@@ -491,10 +505,11 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
491
505
  <p>OCA, or the Odoo Community Association, is a nonprofit organization whose
492
506
  mission is to support the collaborative development of Odoo features and
493
507
  promote its widespread use.</p>
494
- <p>This module is part of the <a class="reference external" href="https://github.com/OCA/social/tree/16.0/mail_gateway_whatsapp">OCA/social</a> project on GitHub.</p>
508
+ <p>This module is part of the <a class="reference external" href="https://github.com/OCA/social/tree/17.0/mail_gateway_whatsapp">OCA/social</a> project on GitHub.</p>
495
509
  <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>
496
510
  </div>
497
511
  </div>
498
512
  </div>
513
+ </div>
499
514
  </body>
500
515
  </html>
@@ -1,10 +1,10 @@
1
1
  <?xml version="1.0" encoding="UTF-8" ?>
2
2
  <templates xml:space="preserve">
3
- <t t-inherit="mail.MessageViewNotification" t-inherit-mode="extension">
3
+ <t t-inherit="mail.Message.notification" t-inherit-mode="extension">
4
4
  <xpath expr="//div" position="after">
5
5
  <i
6
6
  class="fa fa-whatsapp text-info"
7
- t-if="messageView.message.gateway_type == 'whatsapp' and messageView.message.notifications.length == 0"
7
+ t-if="message.gateway_type === 'whatsapp' and message.notifications.length === 0"
8
8
  />
9
9
  </xpath>
10
10
  </t>
@@ -0,0 +1,17 @@
1
+ /* @odoo-module */
2
+ import {Message} from "@mail/core/common/message";
3
+ import {patch} from "@web/core/utils/patch";
4
+ import {url} from "@web/core/utils/urls";
5
+
6
+ patch(Message.prototype, {
7
+ get authorAvatarUrl() {
8
+ if (
9
+ this.message.gateway_type &&
10
+ this.message.gateway_type.includes("whatsapp") &&
11
+ !["partner", "guest"].includes(this.message.author?.type)
12
+ ) {
13
+ return url("/mail_gateway_whatsapp/static/description/icon.png");
14
+ }
15
+ return super.authorAvatarUrl;
16
+ },
17
+ });
@@ -3,7 +3,7 @@
3
3
  import {PhoneField} from "@web/views/fields/phone/phone_field";
4
4
  import {SendWhatsappButton} from "@mail_gateway_whatsapp/components/send_whatsapp_button/send_whatsapp_button.esm";
5
5
  import {patch} from "@web/core/utils/patch";
6
- patch(PhoneField, "mail_gateway_whatsapp.PhoneField", {
6
+ patch(PhoneField, {
7
7
  components: {
8
8
  ...PhoneField.components,
9
9
  SendWhatsappButton,
@@ -3,7 +3,7 @@
3
3
 
4
4
  <t t-inherit="web.PhoneField" t-inherit-mode="extension">
5
5
  <xpath expr="//div[hasclass('o_phone_content')]//a" position="after">
6
- <t t-if="props.enableButton and props.value.length > 0">
6
+ <t t-if="props.enableButton and props.record.data[props.name].length > 0">
7
7
  <SendWhatsappButton t-props="props" />
8
8
  </t>
9
9
  </xpath>
@@ -11,7 +11,7 @@
11
11
 
12
12
  <t t-inherit="web.FormPhoneField" t-inherit-mode="extension">
13
13
  <xpath expr="//div[hasclass('o_phone_content')]" position="inside">
14
- <t t-if="props.enableButton and props.value.length > 0">
14
+ <t t-if="props.enableButton and props.record.data[props.name].length > 0">
15
15
  <SendWhatsappButton t-props="props" />
16
16
  </t>
17
17
  </xpath>
@@ -1,17 +1,17 @@
1
1
  /** @odoo-module **/
2
2
 
3
3
  import {useService} from "@web/core/utils/hooks";
4
-
4
+ import {_t} from "@web/core/l10n/translation";
5
5
  const {Component, status} = owl;
6
6
 
7
7
  export class SendWhatsappButton extends Component {
8
8
  setup() {
9
9
  this.action = useService("action");
10
10
  this.user = useService("user");
11
- this.title = this.env._t("Send Whatsapp Message");
11
+ this.title = _t("Send Whatsapp Message");
12
12
  }
13
13
  get phoneHref() {
14
- return "sms:" + this.props.value.replace(/\s+/g, "");
14
+ return "sms:" + this.props.record.data[this.props.name].replace(/\s+/g, "");
15
15
  }
16
16
  async onClick() {
17
17
  await this.props.record.save();
@@ -166,7 +166,7 @@ class TestMailGatewayWhatsApp(MailGatewayTestCase):
166
166
  ).hexdigest()
167
167
  )
168
168
  self.url_open(
169
- "/gateway/{}/{}/update".format(self.gateway.gateway_type, webhook),
169
+ f"/gateway/{self.gateway.gateway_type}/{webhook}/update",
170
170
  data=data,
171
171
  headers=headers_dict,
172
172
  )
@@ -176,7 +176,9 @@ class TestMailGatewayWhatsApp(MailGatewayTestCase):
176
176
  self.gateway.set_webhook()
177
177
  self.integrate_webhook()
178
178
  self.set_message(message, self.webhook)
179
- chat = self.env["mail.channel"].search([("gateway_id", "=", self.gateway.id)])
179
+ chat = self.env["discuss.channel"].search(
180
+ [("gateway_id", "=", self.gateway.id)]
181
+ )
180
182
  self.assertTrue(chat)
181
183
  self.assertTrue(chat.message_ids)
182
184
  return chat.message_ids
@@ -213,7 +215,7 @@ class TestMailGatewayWhatsApp(MailGatewayTestCase):
213
215
  self.integrate_webhook()
214
216
  self.set_message(self.message_01, self.webhook, False)
215
217
  self.assertFalse(
216
- self.env["mail.channel"].search([("gateway_id", "=", self.gateway.id)])
218
+ self.env["discuss.channel"].search([("gateway_id", "=", self.gateway.id)])
217
219
  )
218
220
 
219
221
  def test_post_wrong_signature_no_message(self):
@@ -233,12 +235,12 @@ class TestMailGatewayWhatsApp(MailGatewayTestCase):
233
235
  ),
234
236
  }
235
237
  self.url_open(
236
- "/gateway/{}/{}/update".format(self.gateway.gateway_type, self.webhook),
238
+ f"/gateway/{self.gateway.gateway_type}/{self.webhook}/update",
237
239
  data=data,
238
240
  headers=headers,
239
241
  )
240
242
  self.assertFalse(
241
- self.env["mail.channel"].search([("gateway_id", "=", self.gateway.id)])
243
+ self.env["discuss.channel"].search([("gateway_id", "=", self.gateway.id)])
242
244
  )
243
245
 
244
246
  def test_send_image(self):
@@ -254,7 +256,7 @@ class TestMailGatewayWhatsApp(MailGatewayTestCase):
254
256
  }
255
257
  )
256
258
  composer.action_view_whatsapp()
257
- channel = self.env["mail.channel"].search(
259
+ channel = self.env["discuss.channel"].search(
258
260
  [("gateway_id", "=", self.gateway.id)]
259
261
  )
260
262
 
@@ -281,7 +283,7 @@ class TestMailGatewayWhatsApp(MailGatewayTestCase):
281
283
  }
282
284
  )
283
285
  composer.action_view_whatsapp()
284
- channel = self.env["mail.channel"].search(
286
+ channel = self.env["discuss.channel"].search(
285
287
  [("gateway_id", "=", self.gateway.id)]
286
288
  )
287
289
  with mute_logger(
@@ -366,7 +368,7 @@ class TestMailGatewayWhatsApp(MailGatewayTestCase):
366
368
  }
367
369
  )
368
370
  composer.action_view_whatsapp()
369
- channel = self.env["mail.channel"].search(
371
+ channel = self.env["discuss.channel"].search(
370
372
  [("gateway_id", "=", self.gateway.id)]
371
373
  )
372
374
  self.assertTrue(channel)
@@ -1,4 +1,4 @@
1
- # https://developers.facebook.com/docs/whatsapp/business-management-api/message-templates/supported-languages # noqa: B950
1
+ # https://developers.facebook.com/docs/whatsapp/business-management-api/message-templates/supported-languages # noqa: B501 E501
2
2
  # res.lang not matching with supported languages(iso codes)
3
3
  supported_languages = [
4
4
  ("af", "Afrikaans"),
@@ -12,7 +12,7 @@
12
12
  type="object"
13
13
  name="button_import_whatsapp_template"
14
14
  string="Download Templates"
15
- attrs="{'invisible': [('gateway_type', '!=', 'whatsapp')]}"
15
+ invisible="gateway_type != 'whatsapp'"
16
16
  icon="fa-download"
17
17
  />
18
18
  </xpath>
@@ -20,7 +20,7 @@
20
20
  <button
21
21
  type="action"
22
22
  name="%(mail_gateway_whatsapp.action_mail_whatsapp_template_gateway)d"
23
- attrs="{'invisible': [('gateway_type', '!=', 'whatsapp')]}"
23
+ invisible="gateway_type != 'whatsapp'"
24
24
  class="oe_stat_button"
25
25
  icon="fa-whatsapp"
26
26
  >
@@ -34,26 +34,23 @@
34
34
  <field name="webhook_user_id" position="after">
35
35
  <field
36
36
  name="whatsapp_account_id"
37
- attrs="{'invisible': [('gateway_type', '!=', 'whatsapp')]}"
37
+ invisible="gateway_type != 'whatsapp'"
38
38
  />
39
39
  <field
40
40
  name="whatsapp_security_key"
41
- attrs="{'invisible': [('gateway_type', '!=', 'whatsapp')]}"
41
+ invisible="gateway_type != 'whatsapp'"
42
42
  />
43
43
  <field
44
44
  name="whatsapp_from_phone"
45
- attrs="{'invisible': [('gateway_type', '!=', 'whatsapp')]}"
46
- />
47
- <field
48
- name="whatsapp_version"
49
- attrs="{'invisible': [('gateway_type', '!=', 'whatsapp')]}"
45
+ invisible="gateway_type != 'whatsapp'"
50
46
  />
47
+ <field name="whatsapp_version" invisible="gateway_type != 'whatsapp'" />
51
48
  </field>
52
49
  <notebook position="inside">
53
50
  <page
54
51
  name="whatsapp"
55
52
  string="Whatsapp configuration info"
56
- attrs="{'invisible': [('gateway_type', '!=', 'whatsapp')]}"
53
+ invisible="gateway_type != 'whatsapp'"
57
54
  >
58
55
  <div>
59
56
  <h2>First steps</h2>
@@ -39,19 +39,19 @@
39
39
  name="button_export_template"
40
40
  type="object"
41
41
  class="oe_highlight"
42
- attrs="{'invisible': [('template_uid', '!=', False)]}"
42
+ invisible="template_uid"
43
43
  />
44
44
  <button
45
45
  string="Sync Template"
46
46
  name="button_sync_template"
47
47
  type="object"
48
- attrs="{'invisible': [('template_uid', '=', False)]}"
48
+ invisible="not template_uid"
49
49
  />
50
50
  <button
51
51
  string="Back to draft"
52
52
  name="button_back2draft"
53
53
  type="object"
54
- attrs="{'invisible': [('state', '=', 'draft')]}"
54
+ invisible="state == 'draft'"
55
55
  />
56
56
  <field
57
57
  name="state"
@@ -62,7 +62,7 @@
62
62
  <div
63
63
  class="alert alert-danger"
64
64
  role="alert"
65
- attrs="{'invisible': ['|',('is_supported', '=', True), ('template_uid', '=', False)]}"
65
+ invisible="is_supported or not template_uid"
66
66
  >
67
67
  This template is not supported because has <strong
68
68
  >variables</strong> or <strong>buttons</strong>.
@@ -74,7 +74,7 @@
74
74
  <field
75
75
  name="name"
76
76
  placeholder="Name"
77
- attrs="{'readonly': [('state', '!=', 'draft')]}"
77
+ readonly="state != 'draft'"
78
78
  />
79
79
  </h1>
80
80
  </div>
@@ -82,27 +82,15 @@
82
82
  <group>
83
83
  <field
84
84
  name="gateway_id"
85
- attrs="{'readonly': [('state', '!=', 'draft')]}"
85
+ readonly="state != 'draft'"
86
86
  options="{'no_create': True}"
87
87
  />
88
- <field
89
- name="category"
90
- attrs="{'readonly': [('state', '!=', 'draft')]}"
91
- />
92
- <field
93
- name="language"
94
- attrs="{'readonly': [('state', '!=', 'draft')]}"
95
- />
88
+ <field name="category" readonly="state != 'draft'" />
89
+ <field name="language" readonly="state != 'draft'" />
96
90
  </group>
97
91
  <group>
98
- <field
99
- name="header"
100
- attrs="{'readonly': [('state', '!=', 'draft')]}"
101
- />
102
- <field
103
- name="footer"
104
- attrs="{'readonly': [('state', '!=', 'draft')]}"
105
- />
92
+ <field name="header" readonly="state != 'draft'" />
93
+ <field name="footer" readonly="state != 'draft'" />
106
94
  <field name="template_name" />
107
95
  <field name="template_uid" />
108
96
  <field
@@ -115,10 +103,7 @@
115
103
  </group>
116
104
  <notebook>
117
105
  <page name="body" string="Body">
118
- <field
119
- name="body"
120
- attrs="{'readonly': [('state', '!=', 'draft')]}"
121
- />
106
+ <field name="body" readonly="state != 'draft'" />
122
107
  </page>
123
108
  </notebook>
124
109
  </sheet>
@@ -25,6 +25,4 @@ class MailComposeGatewayMessage(models.TransientModel):
25
25
  def _action_send_mail(self, auto_commit=False):
26
26
  if self.whatsapp_template_id:
27
27
  self = self.with_context(whatsapp_template_id=self.whatsapp_template_id.id)
28
- return super(MailComposeGatewayMessage, self)._action_send_mail(
29
- auto_commit=auto_commit
30
- )
28
+ return super()._action_send_mail(auto_commit=auto_commit)
@@ -17,14 +17,10 @@
17
17
  />
18
18
  </xpath>
19
19
  <xpath expr="//field[@name='template_id']" position="attributes">
20
- <attribute
21
- name="attrs"
22
- >{'invisible': [('whatsapp_template_id', '!=', False)]}</attribute>
20
+ <attribute name="invisible">whatsapp_template_id</attribute>
23
21
  </xpath>
24
22
  <xpath expr="//field[@name='attachment_ids']" position="attributes">
25
- <attribute
26
- name="attrs"
27
- >{'invisible': [('whatsapp_template_id', '!=', False)]}</attribute>
23
+ <attribute name="invisible">whatsapp_template_id</attribute>
28
24
  </xpath>
29
25
  </field>
30
26
  </record>
@@ -8,7 +8,6 @@ from odoo.exceptions import UserError
8
8
 
9
9
 
10
10
  class WhatsappComposer(models.TransientModel):
11
-
12
11
  _name = "whatsapp.composer"
13
12
  _description = "Compose a whatsapp message"
14
13
 
@@ -99,7 +98,7 @@ class WhatsappComposer(models.TransientModel):
99
98
  return {
100
99
  "type": "ir.actions.client",
101
100
  "tag": "mail.action_discuss",
102
- "params": {"active_id": "{}_{}".format(channel._name, channel.id)},
101
+ "params": {"active_id": f"{channel._name}_{channel.id}"},
103
102
  }
104
103
  return False
105
104
 
@@ -9,13 +9,10 @@
9
9
  <field name="arch" type="xml">
10
10
  <form string="Whatsapp Composer">
11
11
  <group>
12
- <field
13
- name="gateway_id"
14
- attrs="{'invisible': [('find_gateway', '=', False)]}"
15
- />
16
- <field
12
+ <field name="gateway_id" invisible="not find_gateway" />
13
+ <field
17
14
  name="template_id"
18
- attrs="{'required': [('is_required_template', '=', True)]}"
15
+ required="is_required_template"
19
16
  options="{'no_create': True, 'no_open': True}"
20
17
  />
21
18
  <field name="find_gateway" invisible="1" />
@@ -23,11 +20,7 @@
23
20
  <field name="res_id" invisible="1" />
24
21
  <field name="number_field_name" invisible="1" />
25
22
  <field name="is_required_template" invisible="1" />
26
- <field
27
- name="body"
28
- attrs="{'readonly': [('template_id', '!=', False)]}"
29
- force_save="1"
30
- />
23
+ <field name="body" readonly="template_id" force_save="1" />
31
24
  </group>
32
25
  <footer>
33
26
  <button