odoo-addon-mail-gateway-whatsapp 16.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 (37) hide show
  1. odoo/addons/mail_gateway_whatsapp/README.rst +127 -0
  2. odoo/addons/mail_gateway_whatsapp/__init__.py +4 -0
  3. odoo/addons/mail_gateway_whatsapp/__manifest__.py +28 -0
  4. odoo/addons/mail_gateway_whatsapp/i18n/mail_gateway_whatsapp.pot +537 -0
  5. odoo/addons/mail_gateway_whatsapp/models/__init__.py +5 -0
  6. odoo/addons/mail_gateway_whatsapp/models/mail_channel.py +25 -0
  7. odoo/addons/mail_gateway_whatsapp/models/mail_gateway.py +15 -0
  8. odoo/addons/mail_gateway_whatsapp/models/mail_gateway_whatsapp.py +383 -0
  9. odoo/addons/mail_gateway_whatsapp/models/mail_thread.py +65 -0
  10. odoo/addons/mail_gateway_whatsapp/models/res_partner.py +20 -0
  11. odoo/addons/mail_gateway_whatsapp/readme/CONFIGURE.rst +30 -0
  12. odoo/addons/mail_gateway_whatsapp/readme/CONTRIBUTORS.rst +2 -0
  13. odoo/addons/mail_gateway_whatsapp/readme/CREDITS.rst +1 -0
  14. odoo/addons/mail_gateway_whatsapp/readme/DESCRIPTION.rst +4 -0
  15. odoo/addons/mail_gateway_whatsapp/readme/USAGE.rst +3 -0
  16. odoo/addons/mail_gateway_whatsapp/security/ir.model.access.csv +2 -0
  17. odoo/addons/mail_gateway_whatsapp/static/description/icon.png +0 -0
  18. odoo/addons/mail_gateway_whatsapp/static/description/icon.svg +48 -0
  19. odoo/addons/mail_gateway_whatsapp/static/description/index.html +478 -0
  20. odoo/addons/mail_gateway_whatsapp/static/src/components/message/message.xml +11 -0
  21. odoo/addons/mail_gateway_whatsapp/static/src/components/phone_field/phone_field.esm.js +25 -0
  22. odoo/addons/mail_gateway_whatsapp/static/src/components/phone_field/phone_field.xml +20 -0
  23. odoo/addons/mail_gateway_whatsapp/static/src/components/send_whatsapp_button/send_whatsapp_button.esm.js +44 -0
  24. odoo/addons/mail_gateway_whatsapp/static/src/components/send_whatsapp_button/send_whatsapp_button.xml +13 -0
  25. odoo/addons/mail_gateway_whatsapp/static/src/models/message.esm.js +21 -0
  26. odoo/addons/mail_gateway_whatsapp/static/src/models/message_view.esm.js +25 -0
  27. odoo/addons/mail_gateway_whatsapp/static/src/models/notification.esm.js +25 -0
  28. odoo/addons/mail_gateway_whatsapp/tests/__init__.py +1 -0
  29. odoo/addons/mail_gateway_whatsapp/tests/test_mail_gateway_whatsapp.py +308 -0
  30. odoo/addons/mail_gateway_whatsapp/views/mail_gateway.xml +103 -0
  31. odoo/addons/mail_gateway_whatsapp/wizards/__init__.py +1 -0
  32. odoo/addons/mail_gateway_whatsapp/wizards/whatsapp_composer.py +59 -0
  33. odoo/addons/mail_gateway_whatsapp/wizards/whatsapp_composer.xml +50 -0
  34. odoo_addon_mail_gateway_whatsapp-16.0.1.0.0.2.dist-info/METADATA +147 -0
  35. odoo_addon_mail_gateway_whatsapp-16.0.1.0.0.2.dist-info/RECORD +37 -0
  36. odoo_addon_mail_gateway_whatsapp-16.0.1.0.0.2.dist-info/WHEEL +5 -0
  37. odoo_addon_mail_gateway_whatsapp-16.0.1.0.0.2.dist-info/top_level.txt +1 -0
@@ -0,0 +1,478 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
+ <meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
6
+ <title>Mail Whatsapp Gateway</title>
7
+ <style type="text/css">
8
+
9
+ /*
10
+ :Author: David Goodger (goodger@python.org)
11
+ :Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
12
+ :Copyright: This stylesheet has been placed in the public domain.
13
+
14
+ Default cascading style sheet for the HTML output of Docutils.
15
+
16
+ See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
17
+ customize this style sheet.
18
+ */
19
+
20
+ /* used to remove borders from tables and images */
21
+ .borderless, table.borderless td, table.borderless th {
22
+ border: 0 }
23
+
24
+ table.borderless td, table.borderless th {
25
+ /* Override padding for "table.docutils td" with "! important".
26
+ The right padding separates the table cells. */
27
+ padding: 0 0.5em 0 0 ! important }
28
+
29
+ .first {
30
+ /* Override more specific margin styles with "! important". */
31
+ margin-top: 0 ! important }
32
+
33
+ .last, .with-subtitle {
34
+ margin-bottom: 0 ! important }
35
+
36
+ .hidden {
37
+ display: none }
38
+
39
+ .subscript {
40
+ vertical-align: sub;
41
+ font-size: smaller }
42
+
43
+ .superscript {
44
+ vertical-align: super;
45
+ font-size: smaller }
46
+
47
+ a.toc-backref {
48
+ text-decoration: none ;
49
+ color: black }
50
+
51
+ blockquote.epigraph {
52
+ margin: 2em 5em ; }
53
+
54
+ dl.docutils dd {
55
+ margin-bottom: 0.5em }
56
+
57
+ object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
58
+ overflow: hidden;
59
+ }
60
+
61
+ /* Uncomment (and remove this text!) to get bold-faced definition list terms
62
+ dl.docutils dt {
63
+ font-weight: bold }
64
+ */
65
+
66
+ div.abstract {
67
+ margin: 2em 5em }
68
+
69
+ div.abstract p.topic-title {
70
+ font-weight: bold ;
71
+ text-align: center }
72
+
73
+ div.admonition, div.attention, div.caution, div.danger, div.error,
74
+ div.hint, div.important, div.note, div.tip, div.warning {
75
+ margin: 2em ;
76
+ border: medium outset ;
77
+ padding: 1em }
78
+
79
+ div.admonition p.admonition-title, div.hint p.admonition-title,
80
+ div.important p.admonition-title, div.note p.admonition-title,
81
+ div.tip p.admonition-title {
82
+ font-weight: bold ;
83
+ font-family: sans-serif }
84
+
85
+ div.attention p.admonition-title, div.caution p.admonition-title,
86
+ div.danger p.admonition-title, div.error p.admonition-title,
87
+ div.warning p.admonition-title, .code .error {
88
+ color: red ;
89
+ font-weight: bold ;
90
+ font-family: sans-serif }
91
+
92
+ /* Uncomment (and remove this text!) to get reduced vertical space in
93
+ compound paragraphs.
94
+ div.compound .compound-first, div.compound .compound-middle {
95
+ margin-bottom: 0.5em }
96
+
97
+ div.compound .compound-last, div.compound .compound-middle {
98
+ margin-top: 0.5em }
99
+ */
100
+
101
+ div.dedication {
102
+ margin: 2em 5em ;
103
+ text-align: center ;
104
+ font-style: italic }
105
+
106
+ div.dedication p.topic-title {
107
+ font-weight: bold ;
108
+ font-style: normal }
109
+
110
+ div.figure {
111
+ margin-left: 2em ;
112
+ margin-right: 2em }
113
+
114
+ div.footer, div.header {
115
+ clear: both;
116
+ font-size: smaller }
117
+
118
+ div.line-block {
119
+ display: block ;
120
+ margin-top: 1em ;
121
+ margin-bottom: 1em }
122
+
123
+ div.line-block div.line-block {
124
+ margin-top: 0 ;
125
+ margin-bottom: 0 ;
126
+ margin-left: 1.5em }
127
+
128
+ div.sidebar {
129
+ margin: 0 0 0.5em 1em ;
130
+ border: medium outset ;
131
+ padding: 1em ;
132
+ background-color: #ffffee ;
133
+ width: 40% ;
134
+ float: right ;
135
+ clear: right }
136
+
137
+ div.sidebar p.rubric {
138
+ font-family: sans-serif ;
139
+ font-size: medium }
140
+
141
+ div.system-messages {
142
+ margin: 5em }
143
+
144
+ div.system-messages h1 {
145
+ color: red }
146
+
147
+ div.system-message {
148
+ border: medium outset ;
149
+ padding: 1em }
150
+
151
+ div.system-message p.system-message-title {
152
+ color: red ;
153
+ font-weight: bold }
154
+
155
+ div.topic {
156
+ margin: 2em }
157
+
158
+ h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
159
+ h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
160
+ margin-top: 0.4em }
161
+
162
+ h1.title {
163
+ text-align: center }
164
+
165
+ h2.subtitle {
166
+ text-align: center }
167
+
168
+ hr.docutils {
169
+ width: 75% }
170
+
171
+ img.align-left, .figure.align-left, object.align-left, table.align-left {
172
+ clear: left ;
173
+ float: left ;
174
+ margin-right: 1em }
175
+
176
+ img.align-right, .figure.align-right, object.align-right, table.align-right {
177
+ clear: right ;
178
+ float: right ;
179
+ margin-left: 1em }
180
+
181
+ img.align-center, .figure.align-center, object.align-center {
182
+ display: block;
183
+ margin-left: auto;
184
+ margin-right: auto;
185
+ }
186
+
187
+ table.align-center {
188
+ margin-left: auto;
189
+ margin-right: auto;
190
+ }
191
+
192
+ .align-left {
193
+ text-align: left }
194
+
195
+ .align-center {
196
+ clear: both ;
197
+ text-align: center }
198
+
199
+ .align-right {
200
+ text-align: right }
201
+
202
+ /* reset inner alignment in figures */
203
+ div.align-right {
204
+ text-align: inherit }
205
+
206
+ /* div.align-center * { */
207
+ /* text-align: left } */
208
+
209
+ .align-top {
210
+ vertical-align: top }
211
+
212
+ .align-middle {
213
+ vertical-align: middle }
214
+
215
+ .align-bottom {
216
+ vertical-align: bottom }
217
+
218
+ ol.simple, ul.simple {
219
+ margin-bottom: 1em }
220
+
221
+ ol.arabic {
222
+ list-style: decimal }
223
+
224
+ ol.loweralpha {
225
+ list-style: lower-alpha }
226
+
227
+ ol.upperalpha {
228
+ list-style: upper-alpha }
229
+
230
+ ol.lowerroman {
231
+ list-style: lower-roman }
232
+
233
+ ol.upperroman {
234
+ list-style: upper-roman }
235
+
236
+ p.attribution {
237
+ text-align: right ;
238
+ margin-left: 50% }
239
+
240
+ p.caption {
241
+ font-style: italic }
242
+
243
+ p.credits {
244
+ font-style: italic ;
245
+ font-size: smaller }
246
+
247
+ p.label {
248
+ white-space: nowrap }
249
+
250
+ p.rubric {
251
+ font-weight: bold ;
252
+ font-size: larger ;
253
+ color: maroon ;
254
+ text-align: center }
255
+
256
+ p.sidebar-title {
257
+ font-family: sans-serif ;
258
+ font-weight: bold ;
259
+ font-size: larger }
260
+
261
+ p.sidebar-subtitle {
262
+ font-family: sans-serif ;
263
+ font-weight: bold }
264
+
265
+ p.topic-title {
266
+ font-weight: bold }
267
+
268
+ pre.address {
269
+ margin-bottom: 0 ;
270
+ margin-top: 0 ;
271
+ font: inherit }
272
+
273
+ pre.literal-block, pre.doctest-block, pre.math, pre.code {
274
+ margin-left: 2em ;
275
+ margin-right: 2em }
276
+
277
+ pre.code .ln { color: grey; } /* line numbers */
278
+ pre.code, code { background-color: #eeeeee }
279
+ pre.code .comment, code .comment { color: #5C6576 }
280
+ pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
281
+ pre.code .literal.string, code .literal.string { color: #0C5404 }
282
+ pre.code .name.builtin, code .name.builtin { color: #352B84 }
283
+ pre.code .deleted, code .deleted { background-color: #DEB0A1}
284
+ pre.code .inserted, code .inserted { background-color: #A3D289}
285
+
286
+ span.classifier {
287
+ font-family: sans-serif ;
288
+ font-style: oblique }
289
+
290
+ span.classifier-delimiter {
291
+ font-family: sans-serif ;
292
+ font-weight: bold }
293
+
294
+ span.interpreted {
295
+ font-family: sans-serif }
296
+
297
+ span.option {
298
+ white-space: nowrap }
299
+
300
+ span.pre {
301
+ white-space: pre }
302
+
303
+ span.problematic {
304
+ color: red }
305
+
306
+ span.section-subtitle {
307
+ /* font-size relative to parent (h1..h6 element) */
308
+ font-size: 80% }
309
+
310
+ table.citation {
311
+ border-left: solid 1px gray;
312
+ margin-left: 1px }
313
+
314
+ table.docinfo {
315
+ margin: 2em 4em }
316
+
317
+ table.docutils {
318
+ margin-top: 0.5em ;
319
+ margin-bottom: 0.5em }
320
+
321
+ table.footnote {
322
+ border-left: solid 1px black;
323
+ margin-left: 1px }
324
+
325
+ table.docutils td, table.docutils th,
326
+ table.docinfo td, table.docinfo th {
327
+ padding-left: 0.5em ;
328
+ padding-right: 0.5em ;
329
+ vertical-align: top }
330
+
331
+ table.docutils th.field-name, table.docinfo th.docinfo-name {
332
+ font-weight: bold ;
333
+ text-align: left ;
334
+ white-space: nowrap ;
335
+ padding-left: 0 }
336
+
337
+ /* "booktabs" style (no vertical lines) */
338
+ table.docutils.booktabs {
339
+ border: 0px;
340
+ border-top: 2px solid;
341
+ border-bottom: 2px solid;
342
+ border-collapse: collapse;
343
+ }
344
+ table.docutils.booktabs * {
345
+ border: 0px;
346
+ }
347
+ table.docutils.booktabs th {
348
+ border-bottom: thin solid;
349
+ text-align: left;
350
+ }
351
+
352
+ h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
353
+ h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
354
+ font-size: 100% }
355
+
356
+ ul.auto-toc {
357
+ list-style-type: none }
358
+
359
+ </style>
360
+ </head>
361
+ <body>
362
+ <div class="document" id="mail-whatsapp-gateway">
363
+ <h1 class="title">Mail Whatsapp Gateway</h1>
364
+
365
+ <!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
366
+ !! This file is generated by oca-gen-addon-readme !!
367
+ !! changes will be overwritten. !!
368
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
369
+ !! source digest: sha256:7e8914aa79754fb57cdfe774336f8ffe4c6784994839b64e09cf393ed7c2aa4a
370
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
371
+ <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>
372
+ <p>This module allows to respond whatsapp chats.</p>
373
+ <p>This way, a group of users can respond customers or any other set
374
+ of partners in an integrated way.</p>
375
+ <p><strong>Table of contents</strong></p>
376
+ <div class="contents local topic" id="contents">
377
+ <ul class="simple">
378
+ <li><a class="reference internal" href="#configuration" id="toc-entry-1">Configuration</a><ul>
379
+ <li><a class="reference internal" href="#first-steps" id="toc-entry-2">First steps</a></li>
380
+ <li><a class="reference internal" href="#configure-the-gateway" id="toc-entry-3">Configure the gateway</a></li>
381
+ </ul>
382
+ </li>
383
+ <li><a class="reference internal" href="#usage" id="toc-entry-4">Usage</a></li>
384
+ <li><a class="reference internal" href="#bug-tracker" id="toc-entry-5">Bug Tracker</a></li>
385
+ <li><a class="reference internal" href="#credits" id="toc-entry-6">Credits</a><ul>
386
+ <li><a class="reference internal" href="#authors" id="toc-entry-7">Authors</a></li>
387
+ <li><a class="reference internal" href="#contributors" id="toc-entry-8">Contributors</a></li>
388
+ <li><a class="reference internal" href="#other-credits" id="toc-entry-9">Other credits</a></li>
389
+ <li><a class="reference internal" href="#maintainers" id="toc-entry-10">Maintainers</a></li>
390
+ </ul>
391
+ </li>
392
+ </ul>
393
+ </div>
394
+ <div class="section" id="configuration">
395
+ <h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
396
+ <div class="section" id="first-steps">
397
+ <h2><a class="toc-backref" href="#toc-entry-2">First steps</a></h2>
398
+ <p>You need to create a WhatsApp Business Account (WABA), a Meta App and define a phone number.
399
+ 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>
400
+ <p>If you create a test Business Account, passwords will change every 24 hours.</p>
401
+ <p>In order to make the webhook accessible, the system must be public.</p>
402
+ </div>
403
+ <div class="section" id="configure-the-gateway">
404
+ <h2><a class="toc-backref" href="#toc-entry-3">Configure the gateway</a></h2>
405
+ <p>Once you have created the Meta App, you need to add the gateway and webhook.
406
+ In order to make it you must follow this steps:</p>
407
+ <ul class="simple">
408
+ <li>Access <cite>Settings &gt; Emails &gt; Mail Gateway</cite></li>
409
+ <li>Create a Gateway of type <cite>WhatsApp</cite></li>
410
+ </ul>
411
+ <blockquote>
412
+ <ul class="simple">
413
+ <li>Use the Meta App authentication key as <cite>Token</cite> field</li>
414
+ <li>Use the Meta App Phone Number ID as <cite>Whatsapp from Phone</cite> field</li>
415
+ <li>Write your own <cite>Webhook key</cite></li>
416
+ <li>Use the Application Secret Key on <cite>Whatsapp Security Key</cite>. It will be used in order to validate the data</li>
417
+ <li>Press the <cite>Integrate Webhook Key</cite>. In this case, it will not integrate it, we need to make it manually</li>
418
+ <li>Copy the webhook URL</li>
419
+ </ul>
420
+ </blockquote>
421
+ <ul class="simple">
422
+ <li>Access <a class="reference external" href="https://developers.facebook.com/apps/">Facebook Apps website</a></li>
423
+ <li>Access your App then <cite>Whatsapp &gt; Configuration</cite></li>
424
+ <li>Create your webhook using your URL and put the Whatsapp Security Key as validation Key</li>
425
+ <li>Administer the Webhook and activate the messages webhook</li>
426
+ </ul>
427
+ </div>
428
+ </div>
429
+ <div class="section" id="usage">
430
+ <h1><a class="toc-backref" href="#toc-entry-4">Usage</a></h1>
431
+ <ol class="arabic simple">
432
+ <li>Access <cite>Gateway</cite></li>
433
+ <li>Wait until someone starts a conversation.</li>
434
+ <li>Now you will be able to respond and receive messages to this person.</li>
435
+ </ol>
436
+ </div>
437
+ <div class="section" id="bug-tracker">
438
+ <h1><a class="toc-backref" href="#toc-entry-5">Bug Tracker</a></h1>
439
+ <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/social/issues">GitHub Issues</a>.
440
+ In case of trouble, please check there if your issue has already been reported.
441
+ If you spotted it first, help us to smash it by providing a detailed and welcomed
442
+ <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>
443
+ <p>Do not contact contributors directly about support or help with technical issues.</p>
444
+ </div>
445
+ <div class="section" id="credits">
446
+ <h1><a class="toc-backref" href="#toc-entry-6">Credits</a></h1>
447
+ <div class="section" id="authors">
448
+ <h2><a class="toc-backref" href="#toc-entry-7">Authors</a></h2>
449
+ <ul class="simple">
450
+ <li>Creu Blanca</li>
451
+ <li>Dixmit</li>
452
+ </ul>
453
+ </div>
454
+ <div class="section" id="contributors">
455
+ <h2><a class="toc-backref" href="#toc-entry-8">Contributors</a></h2>
456
+ <ul class="simple">
457
+ <li>Olga Marco &lt;<a class="reference external" href="mailto:olga.marco&#64;creublanca.es">olga.marco&#64;creublanca.es</a>&gt;</li>
458
+ <li>Enric Tobella &lt;<a class="reference external" href="mailto:etobella&#64;creublanca.es">etobella&#64;creublanca.es</a>&gt;</li>
459
+ </ul>
460
+ </div>
461
+ <div class="section" id="other-credits">
462
+ <h2><a class="toc-backref" href="#toc-entry-9">Other credits</a></h2>
463
+ <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>
464
+ </div>
465
+ <div class="section" id="maintainers">
466
+ <h2><a class="toc-backref" href="#toc-entry-10">Maintainers</a></h2>
467
+ <p>This module is maintained by the OCA.</p>
468
+ <a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
469
+ <p>OCA, or the Odoo Community Association, is a nonprofit organization whose
470
+ mission is to support the collaborative development of Odoo features and
471
+ promote its widespread use.</p>
472
+ <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>
473
+ <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>
474
+ </div>
475
+ </div>
476
+ </div>
477
+ </body>
478
+ </html>
@@ -0,0 +1,11 @@
1
+ <?xml version="1.0" encoding="UTF-8" ?>
2
+ <templates xml:space="preserve">
3
+ <t t-inherit="mail.MessageViewNotification" t-inherit-mode="extension">
4
+ <xpath expr="//div" position="after">
5
+ <i
6
+ class="fa fa-whatsapp text-info"
7
+ t-if="messageView.message.gateway_type == 'whatsapp' and messageView.message.notifications.length == 0"
8
+ />
9
+ </xpath>
10
+ </t>
11
+ </templates>
@@ -0,0 +1,25 @@
1
+ /** @odoo-module **/
2
+
3
+ import {PhoneField} from "@web/views/fields/phone/phone_field";
4
+ import {SendWhatsappButton} from "@mail_gateway_whatsapp/components/send_whatsapp_button/send_whatsapp_button.esm";
5
+ import {patch} from "@web/core/utils/patch";
6
+ patch(PhoneField, "mail_gateway_whatsapp.PhoneField", {
7
+ components: {
8
+ ...PhoneField.components,
9
+ SendWhatsappButton,
10
+ },
11
+ defaultProps: {
12
+ ...PhoneField.defaultProps,
13
+ enableButton: true,
14
+ },
15
+ props: {
16
+ ...PhoneField.props,
17
+ enableButton: {type: Boolean, optional: true},
18
+ },
19
+ extractProps: ({attrs}) => {
20
+ return {
21
+ enableButton: attrs.options.enable_sms,
22
+ placeholder: attrs.placeholder,
23
+ };
24
+ },
25
+ });
@@ -0,0 +1,20 @@
1
+ <?xml version="1.0" encoding="UTF-8" ?>
2
+ <templates xml:space="preserve">
3
+
4
+ <t t-inherit="web.PhoneField" t-inherit-mode="extension">
5
+ <xpath expr="//div[hasclass('o_phone_content')]//a" position="after">
6
+ <t t-if="props.enableButton and props.value.length > 0">
7
+ <SendWhatsappButton t-props="props" />
8
+ </t>
9
+ </xpath>
10
+ </t>
11
+
12
+ <t t-inherit="web.FormPhoneField" t-inherit-mode="extension">
13
+ <xpath expr="//div[hasclass('o_phone_content')]" position="inside">
14
+ <t t-if="props.enableButton and props.value.length > 0">
15
+ <SendWhatsappButton t-props="props" />
16
+ </t>
17
+ </xpath>
18
+ </t>
19
+
20
+ </templates>
@@ -0,0 +1,44 @@
1
+ /** @odoo-module **/
2
+
3
+ import {useService} from "@web/core/utils/hooks";
4
+
5
+ const {Component, status} = owl;
6
+
7
+ export class SendWhatsappButton extends Component {
8
+ setup() {
9
+ this.action = useService("action");
10
+ this.user = useService("user");
11
+ this.title = this.env._t("Send Whatsapp Message");
12
+ }
13
+ get phoneHref() {
14
+ return "sms:" + this.props.value.replace(/\s+/g, "");
15
+ }
16
+ async onClick() {
17
+ await this.props.record.save();
18
+ this.action.doAction(
19
+ {
20
+ type: "ir.actions.act_window",
21
+ target: "new",
22
+ name: this.title,
23
+ res_model: "whatsapp.composer",
24
+ views: [[false, "form"]],
25
+ context: {
26
+ ...this.user.context,
27
+ default_res_model: this.props.record.resModel,
28
+ default_res_id: this.props.record.resId,
29
+ default_number_field_name: this.props.name,
30
+ default_composition_mode: "comment",
31
+ },
32
+ },
33
+ {
34
+ onClose: () => {
35
+ if (status(this) !== "destroyed") {
36
+ this.props.record.load();
37
+ this.props.record.model.notify();
38
+ }
39
+ },
40
+ }
41
+ );
42
+ }
43
+ }
44
+ SendWhatsappButton.template = "mail_gateway_whatsapp.SendWhatsappButton";
@@ -0,0 +1,13 @@
1
+ <?xml version="1.0" encoding="UTF-8" ?>
2
+ <templates xml:space="preserve">
3
+
4
+ <t t-name="mail_gateway_whatsapp.SendWhatsappButton" owl="1">
5
+ <a
6
+ t-att-title="title"
7
+ t-att-href="phoneHref"
8
+ t-on-click.prevent.stop="onClick"
9
+ class="ms-3 d-inline-flex align-items-center o_field_phone_whatsapp"
10
+ ><i class="fa fa-whatsapp" /><small class="fw-bold ms-1">Whatsapp</small></a>
11
+ </t>
12
+
13
+ </templates>
@@ -0,0 +1,21 @@
1
+ /** @odoo-module **/
2
+
3
+ import {registerPatch} from "@mail/model/model_core";
4
+
5
+ registerPatch({
6
+ name: "Message",
7
+ fields: {
8
+ avatarUrl: {
9
+ compute() {
10
+ if (
11
+ !this.author &&
12
+ !this.guestAuthor &&
13
+ this.gateway_type === "whatsapp"
14
+ ) {
15
+ return "/mail_gateway_whatsapp/static/description/icon.png";
16
+ }
17
+ return this._super();
18
+ },
19
+ },
20
+ },
21
+ });
@@ -0,0 +1,25 @@
1
+ /** @odoo-module **/
2
+
3
+ import {registerPatch} from "@mail/model/model_core";
4
+
5
+ registerPatch({
6
+ name: "MessageView",
7
+ fields: {
8
+ notificationIconClassName: {
9
+ compute() {
10
+ if (this.message && this.message.gateway_type === "whatsapp") {
11
+ return "fa fa-whatsapp";
12
+ }
13
+ return this._super();
14
+ },
15
+ },
16
+ failureNotificationIconClassName: {
17
+ compute() {
18
+ if (this.message && this.message.gateway_type === "whatsapp") {
19
+ return "fa fa-whatsapp";
20
+ }
21
+ return this._super();
22
+ },
23
+ },
24
+ },
25
+ });
@@ -0,0 +1,25 @@
1
+ /** @odoo-module **/
2
+
3
+ import {registerPatch} from "@mail/model/model_core";
4
+
5
+ registerPatch({
6
+ name: "Notification",
7
+ fields: {
8
+ iconClass: {
9
+ compute() {
10
+ if (
11
+ this.notification_type === "gateway" &&
12
+ this.gateway_type === "whatsapp"
13
+ ) {
14
+ switch (this.notification_status) {
15
+ case "sent":
16
+ return "fa fa-whatsapp";
17
+ case "exception":
18
+ return "fa fa-whatsapp text-danger";
19
+ }
20
+ }
21
+ return this._super();
22
+ },
23
+ },
24
+ },
25
+ });
@@ -0,0 +1 @@
1
+ from . import test_mail_gateway_whatsapp