[MIG] mail_gateway_whatsapp: Migration to 19.0 - #203
DucTruongKomit wants to merge 63 commits into
Conversation
c7e221d to
6639a38
Compare
6639a38 to
56e3f02
Compare
125dd08 to
f569f39
Compare
c8b5408 to
7386cf0
Compare
7386cf0 to
009bb90
Compare
|
To include #1902 and #1909 |
89ff506 to
acc1ec8
Compare
I already solved it, thank you. |
|
Functional test with the real WhatsApp Cloud API 👍 I tested this branch at Automated tests: With Meta, end to end:
One thing worth documenting (or fixing): if The call chain is Not tested: templates, media messages and delivery status updates. Thanks for the migration! |
|
/ocabot migration mail_gateway_whatsapp |
acc1ec8 to
c2e783b
Compare
Currently translated at 100.0% (254 of 254 strings) Translation: social-18.0/social-18.0-mail_gateway_whatsapp Translate-URL: https://translation.odoo-community.org/projects/social-18-0/social-18-0-mail_gateway_whatsapp/it/
…th that mark, discuss will show an audio player instead of a download button. For reference, this is where the "voice" key is detected and the attachment is processed as such: https://github.com/odoo/odoo/blob/3a54f1e4b706d6732d8dc16bc206f5fc4d6ab923/addons/mail/models/discuss/ir_attachment.py#L29-L32
Currently translated at 100.0% (254 of 254 strings) Translation: social-18.0/social-18.0-mail_gateway_whatsapp Translate-URL: https://translation.odoo-community.org/projects/social-18-0/social-18-0-mail_gateway_whatsapp/es/
When a message from whatsapp arrives and it's a response from a message sent from Odoo, set the parent_id field.
… body. Currently, attachment captions are disregarded.
Currently translated at 4.3% (11 of 254 strings) Translation: social-18.0/social-18.0-mail_gateway_whatsapp Translate-URL: https://translation.odoo-community.org/projects/social-18-0/social-18-0-mail_gateway_whatsapp/gl/
Currently translated at 8.2% (21 of 254 strings) Translation: social-18.0/social-18.0-mail_gateway_whatsapp Translate-URL: https://translation.odoo-community.org/projects/social-18-0/social-18-0-mail_gateway_whatsapp/gl/
Currently translated at 11.4% (29 of 254 strings) Translation: social-18.0/social-18.0-mail_gateway_whatsapp Translate-URL: https://translation.odoo-community.org/projects/social-18-0/social-18-0-mail_gateway_whatsapp/gl/
Currently translated at 100.0% (254 of 254 strings) Translation: social-18.0/social-18.0-mail_gateway_whatsapp Translate-URL: https://translation.odoo-community.org/projects/social-18-0/social-18-0-mail_gateway_whatsapp/es/
Currently translated at 49.6% (126 of 254 strings) Translation: social-18.0/social-18.0-mail_gateway_whatsapp Translate-URL: https://translation.odoo-community.org/projects/social-18-0/social-18-0-mail_gateway_whatsapp/pt_BR/
Currently translated at 61.0% (155 of 254 strings) Translation: social-18.0/social-18.0-mail_gateway_whatsapp Translate-URL: https://translation.odoo-community.org/projects/social-18-0/social-18-0-mail_gateway_whatsapp/gl/
Currently translated at 65.7% (167 of 254 strings) Translation: social-18.0/social-18.0-mail_gateway_whatsapp Translate-URL: https://translation.odoo-community.org/projects/social-18-0/social-18-0-mail_gateway_whatsapp/gl/
Currently translated at 89.3% (227 of 254 strings) Translation: social-18.0/social-18.0-mail_gateway_whatsapp Translate-URL: https://translation.odoo-community.org/projects/social-18-0/social-18-0-mail_gateway_whatsapp/gl/
… with WhatsApp gateway
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: social-18.0/social-18.0-mail_gateway_whatsapp Translate-URL: https://translation.odoo-community.org/projects/social-18-0/social-18-0-mail_gateway_whatsapp/
Currently translated at 100.0% (255 of 255 strings) Translation: social-18.0/social-18.0-mail_gateway_whatsapp Translate-URL: https://translation.odoo-community.org/projects/social-18-0/social-18-0-mail_gateway_whatsapp/it/
…record Nothing enforces uniqueness on (gateway_id, gateway_token), so two webhooks delivered in parallel for the same unknown number each create their own record. The unbounded searches in _get_author then return both, and every later message of that correspondent fails on ensure_one(): the webhook answers 500 and the delivery is lost. limit=1 bounds both searches. The default _order is id, so the oldest record wins.
Incoming text was passed raw to message_post. mail_thread only escapes a str body, and escape() does not turn newlines into markup, so a multi-line message was archived as a single block and its URLs were not clickable. The assembled body (text plus media captions) now goes through plaintext2html before both message_post calls of _process_update, mirroring the outgoing path where the body is sent as html2plaintext(body). The same root cause affected the location branch: the anchor was built as a str, so escape() rendered it as literal HTML instead of a link. It is now built as Markup, with % interpolation so the payload coordinates stay escaped. A test covers a multi-line incoming message carrying a location: line breaks rendered, blank line kept as a paragraph break, URL turned into a link, markup-looking text left literal, and the location anchor kept as a link.
WhatsApp clients mark up text with *bold*, _italic_, ~strikethrough~ and ```monospace```. Incoming, those markers were archived as literal characters. Outgoing, html2plaintext sent <strong> as *bold*, which WhatsApp happens to read as bold, but <em> as /italic/, which it shows as is, and dropped the other tags. Both ways now use the same table. Incoming, the markers are turned into html tags after plaintext2html, leaving the tags and links it produced alone. Outgoing, the formatting tags are turned back into markers before html2plaintext. Tests cover an incoming message carrying markers and a link whose url holds an underscore, and an outgoing message carrying bold and italic.
4780be9 to
ec43cce
Compare
[MIG] mail_gateway_whatsapp: Migration to 19.0
This module is depended to mail_gateway in PR: #202.
So I added the Commits here for test.