odoo-addon-mail-gateway-whatsapp 16.0.1.1.0.9__py3-none-any.whl → 17.0.1.0.1__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 (43) 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 +124 -136
  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 +53 -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.9.dist-info → odoo_addon_mail_gateway_whatsapp-17.0.1.0.1.dist-info}/METADATA +69 -52
  31. odoo_addon_mail_gateway_whatsapp-17.0.1.0.1.dist-info/RECORD +46 -0
  32. {odoo_addon_mail_gateway_whatsapp-16.0.1.1.0.9.dist-info → odoo_addon_mail_gateway_whatsapp-17.0.1.0.1.dist-info}/WHEEL +1 -1
  33. odoo_addon_mail_gateway_whatsapp-17.0.1.0.1.dist-info/top_level.txt +1 -0
  34. odoo/addons/mail_gateway_whatsapp/i18n/es_VE.po +0 -1181
  35. odoo/addons/mail_gateway_whatsapp/readme/CONFIGURE.rst +0 -31
  36. odoo/addons/mail_gateway_whatsapp/readme/CONTRIBUTORS.rst +0 -5
  37. odoo/addons/mail_gateway_whatsapp/readme/ROADMAP.rst +0 -4
  38. odoo/addons/mail_gateway_whatsapp/readme/USAGE.rst +0 -3
  39. odoo/addons/mail_gateway_whatsapp/static/src/models/message.esm.js +0 -21
  40. odoo/addons/mail_gateway_whatsapp/static/src/models/message_view.esm.js +0 -25
  41. odoo/addons/mail_gateway_whatsapp/static/src/models/notification.esm.js +0 -25
  42. odoo_addon_mail_gateway_whatsapp-16.0.1.1.0.9.dist-info/RECORD +0 -49
  43. odoo_addon_mail_gateway_whatsapp-16.0.1.1.0.9.dist-info/top_level.txt +0 -1
@@ -6,7 +6,7 @@ msgid ""
6
6
  msgstr ""
7
7
  "Project-Id-Version: Odoo Server 16.0\n"
8
8
  "Report-Msgid-Bugs-To: \n"
9
- "PO-Revision-Date: 2025-06-03 07:06+0000\n"
9
+ "PO-Revision-Date: 2025-01-09 13:06+0000\n"
10
10
  "Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
11
11
  "Language-Team: none\n"
12
12
  "Language: it\n"
@@ -14,7 +14,7 @@ msgstr ""
14
14
  "Content-Type: text/plain; charset=UTF-8\n"
15
15
  "Content-Transfer-Encoding: \n"
16
16
  "Plural-Forms: nplurals=2; plural=n != 1;\n"
17
- "X-Generator: Weblate 5.10.4\n"
17
+ "X-Generator: Weblate 5.6.2\n"
18
18
 
19
19
  #. module: mail_gateway_whatsapp
20
20
  #: model_terms:ir.ui.view,arch_db:mail_gateway_whatsapp.mail_gateway_form_view
@@ -111,7 +111,7 @@ msgstr "Azerbaigiano"
111
111
  #. module: mail_gateway_whatsapp
112
112
  #: model_terms:ir.ui.view,arch_db:mail_gateway_whatsapp.view_mail_whatsapp_template_form
113
113
  msgid "Back to draft"
114
- msgstr "Reimposta a bozza"
114
+ msgstr "Ritorna a bozza"
115
115
 
116
116
  #. module: mail_gateway_whatsapp
117
117
  #: model:ir.model.fields.selection,name:mail_gateway_whatsapp.selection__mail_whatsapp_template__language__bn
@@ -699,21 +699,11 @@ msgstr "Contenuto messaggio"
699
699
  msgid "Message Delivery error"
700
700
  msgstr "Errore di consegna messaggio"
701
701
 
702
- #. module: mail_gateway_whatsapp
703
- #: model:ir.model.fields,field_description:mail_gateway_whatsapp.field_res_partner__message_search
704
- msgid "Message Search"
705
- msgstr "Ricerca messaggio"
706
-
707
702
  #. module: mail_gateway_whatsapp
708
703
  #: model:ir.model.fields,help:mail_gateway_whatsapp.field_res_partner__message_content
709
704
  msgid "Message content, to be used only in searches"
710
705
  msgstr "Contenuto messaggio, da utilizzare solo nelle ricerche"
711
706
 
712
- #. module: mail_gateway_whatsapp
713
- #: model:ir.model.fields,help:mail_gateway_whatsapp.field_res_partner__message_search
714
- msgid "Message search, to be used only in searches"
715
- msgstr "Ricerca messaggio, da utilizzare solo nelle ricerche"
716
-
717
707
  #. module: mail_gateway_whatsapp
718
708
  #: model:ir.model.fields,field_description:mail_gateway_whatsapp.field_res_partner__message_ids
719
709
  msgid "Messages"
@@ -4,7 +4,7 @@
4
4
  #
5
5
  msgid ""
6
6
  msgstr ""
7
- "Project-Id-Version: Odoo Server 16.0\n"
7
+ "Project-Id-Version: Odoo Server 17.0\n"
8
8
  "Report-Msgid-Bugs-To: \n"
9
9
  "Last-Translator: \n"
10
10
  "Language-Team: \n"
@@ -254,7 +254,7 @@ msgid "Disabled"
254
254
  msgstr ""
255
255
 
256
256
  #. module: mail_gateway_whatsapp
257
- #: model:ir.model,name:mail_gateway_whatsapp.model_mail_channel
257
+ #: model:ir.model,name:mail_gateway_whatsapp.model_discuss_channel
258
258
  msgid "Discussion Channel"
259
259
  msgstr ""
260
260
 
@@ -570,12 +570,6 @@ msgstr ""
570
570
  msgid "Lao"
571
571
  msgstr ""
572
572
 
573
- #. module: mail_gateway_whatsapp
574
- #: model:ir.model.fields,field_description:mail_gateway_whatsapp.field_mail_whatsapp_template____last_update
575
- #: model:ir.model.fields,field_description:mail_gateway_whatsapp.field_whatsapp_composer____last_update
576
- msgid "Last Modified on"
577
- msgstr ""
578
-
579
573
  #. module: mail_gateway_whatsapp
580
574
  #: model:ir.model.fields,field_description:mail_gateway_whatsapp.field_mail_whatsapp_template__write_uid
581
575
  #: model:ir.model.fields,field_description:mail_gateway_whatsapp.field_whatsapp_composer__write_uid
@@ -623,11 +617,6 @@ msgstr ""
623
617
  msgid "Mail WhatsApp template"
624
618
  msgstr ""
625
619
 
626
- #. module: mail_gateway_whatsapp
627
- #: model:ir.model.fields,field_description:mail_gateway_whatsapp.field_res_partner__message_main_attachment_id
628
- msgid "Main Attachment"
629
- msgstr ""
630
-
631
620
  #. module: mail_gateway_whatsapp
632
621
  #: model:ir.model.fields.selection,name:mail_gateway_whatsapp.selection__mail_whatsapp_template__language__ms
633
622
  msgid "Malay"
@@ -663,21 +652,11 @@ msgstr ""
663
652
  msgid "Message Delivery error"
664
653
  msgstr ""
665
654
 
666
- #. module: mail_gateway_whatsapp
667
- #: model:ir.model.fields,field_description:mail_gateway_whatsapp.field_res_partner__message_search
668
- msgid "Message Search"
669
- msgstr ""
670
-
671
655
  #. module: mail_gateway_whatsapp
672
656
  #: model:ir.model.fields,help:mail_gateway_whatsapp.field_res_partner__message_content
673
657
  msgid "Message content, to be used only in searches"
674
658
  msgstr ""
675
659
 
676
- #. module: mail_gateway_whatsapp
677
- #: model:ir.model.fields,help:mail_gateway_whatsapp.field_res_partner__message_search
678
- msgid "Message search, to be used only in searches"
679
- msgstr ""
680
-
681
660
  #. module: mail_gateway_whatsapp
682
661
  #: model:ir.model.fields,field_description:mail_gateway_whatsapp.field_res_partner__message_ids
683
662
  msgid "Messages"
@@ -1,6 +1,6 @@
1
1
  from . import mail_gateway
2
2
  from . import mail_thread
3
3
  from . import mail_gateway_whatsapp
4
- from . import mail_channel
4
+ from . import discuss_channel
5
5
  from . import res_partner
6
6
  from . import mail_whatsapp_template
@@ -2,21 +2,18 @@
2
2
  # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3
3
 
4
4
  from odoo import models
5
- from odoo.modules.module import get_resource_path
5
+ from odoo.tools.misc import file_path
6
6
 
7
7
  from odoo.addons.base.models.avatar_mixin import get_hsl_from_seed
8
8
 
9
9
 
10
- class MailChannel(models.Model):
11
-
12
- _inherit = "mail.channel"
10
+ class DiscussChannel(models.Model):
11
+ _inherit = "discuss.channel"
13
12
 
14
13
  def _generate_avatar_gateway(self):
15
14
  if self.gateway_id.gateway_type == "whatsapp":
16
- path = get_resource_path(
17
- "mail_gateway_whatsapp", "static/description", "icon.svg"
18
- )
19
- with open(path, "r") as f:
15
+ path = file_path("mail_gateway_whatsapp/static/description/icon.svg")
16
+ with open(path) as f:
20
17
  avatar = f.read()
21
18
 
22
19
  bgcolor = get_hsl_from_seed(self.uuid)
@@ -76,6 +76,38 @@ class MailGatewayWhatsappService(models.AbstractModel):
76
76
  if not chat:
77
77
  continue
78
78
  self._process_update(chat, message, change["value"])
79
+ for status_info in change["value"].get("statuses", []):
80
+ chat_id = gateway._get_channel_id(status_info["recipient_id"])
81
+ if status_info.get("status", "") != "failed" or not chat_id:
82
+ continue
83
+ self._process_update_status(chat_id, status_info)
84
+
85
+ def _process_update_status(self, chat_id, status_info):
86
+ notification = (
87
+ self.env["mail.notification"]
88
+ .sudo()
89
+ .search(
90
+ [
91
+ ("gateway_message_id", "=", status_info["id"]),
92
+ ("gateway_channel_id", "=", chat_id),
93
+ ]
94
+ )
95
+ )
96
+ if not notification:
97
+ return
98
+ errors = [
99
+ f"[{error['code']}] {error['error_data']['details']}"
100
+ for error in status_info.get("errors", [])
101
+ ]
102
+ notification.write(
103
+ {
104
+ "failure_type": "unknown",
105
+ "notification_status": "exception",
106
+ "failure_reason": "\n".join(errors),
107
+ }
108
+ )
109
+ # notify user that we have a failure
110
+ notification.mail_message_id._notify_message_notification_update()
79
111
 
80
112
  def _process_update(self, chat, message, value):
81
113
  chat.ensure_one()
@@ -88,13 +120,10 @@ class MailGatewayWhatsappService(models.AbstractModel):
88
120
  image_id = message.get(key).get("id")
89
121
  if image_id:
90
122
  image_info_request = requests.get(
91
- "https://graph.facebook.com/v%s/%s"
92
- % (
93
- chat.gateway_id.whatsapp_version,
94
- image_id,
95
- ),
123
+ f"https://graph.facebook.com/"
124
+ f"v{chat.gateway_id.whatsapp_version}/{image_id}",
96
125
  headers={
97
- "Authorization": "Bearer %s" % chat.gateway_id.token,
126
+ "Authorization": f"Bearer {chat.gateway_id.token}",
98
127
  },
99
128
  timeout=10,
100
129
  proxies=self._get_proxies(),
@@ -127,17 +156,19 @@ class MailGatewayWhatsappService(models.AbstractModel):
127
156
  if message.get("location"):
128
157
  body += (
129
158
  '<a target="_blank" href="https://www.google.com/'
130
- 'maps/search/?api=1&query=%s,%s">Location</a>'
131
- % (
132
- message["location"]["latitude"],
133
- message["location"]["longitude"],
134
- )
159
+ f'maps/search/?api=1&query={message["location"]["latitude"]},'
160
+ f'{message["location"]["longitude"]}">Location</a>'
135
161
  )
136
162
  if message.get("contacts"):
137
163
  pass
138
164
  if len(body) > 0 or attachments:
139
165
  author = self._get_author(chat.gateway_id, value)
140
- new_message = chat.message_post(
166
+ if author._name == "mail.guest":
167
+ chat = chat.with_user(self.env.ref("base.public_user").id).with_context(
168
+ guest=author
169
+ )
170
+ # TODO: Check the sudo...
171
+ new_message = chat.sudo().message_post(
141
172
  body=body,
142
173
  author_id=author and author._name == "res.partner" and author.id,
143
174
  gateway_type="whatsapp",
@@ -208,13 +239,10 @@ class MailGatewayWhatsappService(models.AbstractModel):
208
239
  )
209
240
 
210
241
  response = requests.post(
211
- "https://graph.facebook.com/v%s/%s/media"
212
- % (
213
- gateway.whatsapp_version,
214
- gateway.whatsapp_from_phone,
215
- ),
242
+ f"https://graph.facebook.com/"
243
+ f"v{gateway.whatsapp_version}/{gateway.whatsapp_from_phone}/media",
216
244
  headers={
217
- "Authorization": "Bearer %s" % gateway.token,
245
+ "Authorization": f"Bearer {gateway.token}",
218
246
  "content-type": m.content_type,
219
247
  },
220
248
  data=m,
@@ -223,12 +251,9 @@ class MailGatewayWhatsappService(models.AbstractModel):
223
251
  )
224
252
  response.raise_for_status()
225
253
  response = requests.post(
226
- "https://graph.facebook.com/v%s/%s/messages"
227
- % (
228
- gateway.whatsapp_version,
229
- gateway.whatsapp_from_phone,
230
- ),
231
- headers={"Authorization": "Bearer %s" % gateway.token},
254
+ f"https://graph.facebook.com/"
255
+ f"v{gateway.whatsapp_version}/{gateway.whatsapp_from_phone}/messages",
256
+ headers={"Authorization": f"Bearer {gateway.token}"},
232
257
  json=self._send_payload(
233
258
  record.gateway_channel_id,
234
259
  media_id=response.json()["id"],
@@ -243,12 +268,9 @@ class MailGatewayWhatsappService(models.AbstractModel):
243
268
  body = self._get_message_body(record)
244
269
  if body:
245
270
  response = requests.post(
246
- "https://graph.facebook.com/v%s/%s/messages"
247
- % (
248
- gateway.whatsapp_version,
249
- gateway.whatsapp_from_phone,
250
- ),
251
- headers={"Authorization": "Bearer %s" % gateway.token},
271
+ f"https://graph.facebook.com/"
272
+ f"v{gateway.whatsapp_version}/{gateway.whatsapp_from_phone}/messages",
273
+ headers={"Authorization": f"Bearer {gateway.token}"},
252
274
  json=self._send_payload(record.gateway_channel_id, body=body),
253
275
  timeout=10,
254
276
  proxies=self._get_proxies(),
@@ -264,9 +286,7 @@ class MailGatewayWhatsappService(models.AbstractModel):
264
286
  _("Unable to send the whatsapp message")
265
287
  ) from exc
266
288
  else:
267
- _logger.warning(
268
- "Issue sending message with id {}: {}".format(record.id, exc)
269
- )
289
+ _logger.warning(f"Issue sending message with id {record.id}: {exc}")
270
290
  record.sudo().write(
271
291
  {"notification_status": "exception", "failure_reason": exc}
272
292
  )
@@ -4,11 +4,8 @@
4
4
  from odoo import _, models
5
5
  from odoo.exceptions import UserError
6
6
 
7
- from odoo.addons.phone_validation.tools import phone_validation
8
-
9
7
 
10
8
  class MailThread(models.AbstractModel):
11
-
12
9
  _inherit = "mail.thread"
13
10
 
14
11
  def _get_whatsapp_channel_vals(self, token, gateway, partner):
@@ -22,12 +19,11 @@ class MailThread(models.AbstractModel):
22
19
  return result
23
20
 
24
21
  def _whatsapp_get_channel(self, field_name, gateway):
25
- phone = self[field_name]
26
- sanitize_res = phone_validation.phone_sanitize_numbers_w_record([phone], self)
27
- sanitized_number = sanitize_res[phone].get("sanitized")
22
+ sanitized_number = self._phone_format(number=self[field_name])
28
23
  if not sanitized_number:
29
24
  raise UserError(_("Phone cannot be sanitized"))
30
- sanitized_number = sanitized_number[1:]
25
+ # Avoid the plus sign prefix to match the whatsapp token
26
+ sanitized_number = sanitized_number.replace("+", "")
31
27
  partner = self._whatsapp_get_partner()
32
28
  if not self.env["res.partner.gateway.channel"].search(
33
29
  [
@@ -0,0 +1,35 @@
1
+ ## First steps
2
+
3
+ You need to create a WhatsApp Business Account (WABA), a Meta App and
4
+ define a phone number. You can follow this
5
+ [steps](https://developers.facebook.com/micro_site/url/?click_from_context_menu=true&country=ES&destination=https%3A%2F%2Fwww.facebook.com%2Fbusiness%2Fhelp%2F2087193751603668&event_type=click&last_nav_impression_id=0m3TRxrxOlly1eRmB&max_percent_page_viewed=22&max_viewport_height_px=1326&max_viewport_width_px=2560&orig_http_referrer=https%3A%2F%2Fdevelopers.facebook.com%2Fdocs%2Fwhatsapp%2Fcloud-api%2Fget-started-for-bsps%3Flocale%3Den_US&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&region=emea&scrolled=false&session_id=1jLoVJNU6iVMaw3ml&site=developers).
6
+
7
+ If you create a test Business Account, passwords will change every 24
8
+ hours.
9
+
10
+ In order to make the webhook accessible, the system must be public.
11
+
12
+ ## Configure the gateway
13
+
14
+ Once you have created the Meta App, you need to add the gateway and
15
+ webhook. In order to make it you must follow this steps:
16
+
17
+ - Access Settings \> Emails \> Mail Gateway
18
+ - Create a Gateway of type WhatsApp
19
+
20
+ > - Use the Meta App authentication key as Token field
21
+ > - Use the Meta App Phone Number ID as Whatsapp from Phone field
22
+ > - Use the Meta Account Business ID as Whatsapp account field (only if
23
+ > you need sync templates)
24
+ > - Write your own Webhook key
25
+ > - Use the Application Secret Key on Whatsapp Security Key. It will be
26
+ > used in order to validate the data
27
+ > - Press the Integrate Webhook Key. In this case, it will not integrate
28
+ > it, we need to make it manually
29
+ > - Copy the webhook URL
30
+
31
+ - Access [Facebook Apps website](https://developers.facebook.com/apps/)
32
+ - Access your App then Whatsapp \> Configuration
33
+ - Create your webhook using your URL and put the Whatsapp Security Key
34
+ as validation Key
35
+ - Administer the Webhook and activate the messages webhook
@@ -0,0 +1,7 @@
1
+ - Olga Marco \<<olga.marco@creublanca.es>\>
2
+
3
+ - Enric Tobella \<<etobella@creublanca.es>\>
4
+
5
+ - [Tecnativa](https://www.tecnativa.com):
6
+
7
+ > - Carlos Lopez
@@ -1 +1,2 @@
1
- This work has been funded by AEOdoo (Asociación Española de Odoo - https://www.aeodoo.org)
1
+ This work has been funded by AEOdoo (Asociación Española de Odoo -
2
+ <https://www.aeodoo.org>)
@@ -1,4 +1,4 @@
1
1
  This module allows to respond whatsapp chats.
2
2
 
3
- This way, a group of users can respond customers or any other set
4
- of partners in an integrated way.
3
+ This way, a group of users can respond customers or any other set of
4
+ partners in an integrated way.
@@ -0,0 +1,4 @@
1
+ **WhatsApp templates**
2
+
3
+ - Add support for Variables
4
+ - Add support for Buttons
@@ -0,0 +1,3 @@
1
+ 1. Access Gateway
2
+ 2. Wait until someone starts a conversation.
3
+ 3. Now you will be able to respond and receive messages to this person.
@@ -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:f99745f99127d060c4731aa38e0797139d71324cd21800ee7e6c72d581d90e9b
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,