Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][IMP] mail_gateway_whatsapp: Add support for WhatsApp templates #1497

Merged

Conversation

carlos-lopez-tecnativa
Copy link
Contributor

@carlos-lopez-tecnativa carlos-lopez-tecnativa commented Nov 14, 2024

If the company wants to initiate a conversation with a customer, a template must be used; otherwise, messages will not be sent. This also applies when the last conversation with the customer is older than 24 hours.

  • Enabled downloading templates from META
  • Added the ability to create templates directly in Odoo.

Note: Currently does not support templates with variables or buttons

TT51660
@Tecnativa @pedrobaeza @chienandalu @etobella could you please review this

@matteoopenf

This comment was marked as off-topic.

@pedrobaeza

This comment was marked as off-topic.

@carlos-lopez-tecnativa carlos-lopez-tecnativa force-pushed the 16.0-mail_gateway_whatsapp-add-templates branch from 067229c to 843eb4f Compare November 14, 2024 17:28
@carlos-lopez-tecnativa
Copy link
Contributor Author

I fixed the test issues related to the module mail_gateway_whatsapp, but I'm not sure if the other errors are related(mail_composer_cc_bcc_account). Could you please take a look? @pedrobaeza @etobella
https://github.com/OCA/social/actions/runs/11842395654/job/33000889279?pr=1497#step:8:1146

Copy link
Member

@etobella etobella left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At a technical Level LGTM

Copy link

@cuongnmtm cuongnmtm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (code review and functional test).

@etobella
Copy link
Member

CI is working in main branch, can you apply my suggestion and rebase?

If the company wants to initiate a conversation with a customer, a template must be used; otherwise, messages will not be sent.
This also applies when the last conversation with the customer is older than 24 hours.

- Enabled downloading templates from META
- Added the ability to create templates directly in Odoo.

Note: Currently, templates with variables or buttons are not supported.
@carlos-lopez-tecnativa carlos-lopez-tecnativa force-pushed the 16.0-mail_gateway_whatsapp-add-templates branch from f3b76db to a1b09e6 Compare December 31, 2024 10:50
…ated to the current user

- Use OdooBot for webhooks instead of the current user, following the same logic as Odoo.
- Avoid automatically adding the current user as a member of a new gateway to prevent notifications for all messages. This is now an explicit configuration.
@carlos-lopez-tecnativa carlos-lopez-tecnativa force-pushed the 16.0-mail_gateway_whatsapp-add-templates branch from a1b09e6 to 455fa12 Compare December 31, 2024 11:13
@carlos-lopez-tecnativa
Copy link
Contributor Author

CI is working in main branch, can you apply my suggestion and rebase?

I have updated the code and fixed the test. Could you please review it again?

@carlos-lopez-tecnativa carlos-lopez-tecnativa marked this pull request as ready for review December 31, 2024 11:17
@@ -25,12 +25,10 @@ class MailGateway(models.Model):
)
webhook_user_id = fields.Many2one(
"res.users",
default=lambda self: self.env.user.id,
default=lambda self: self.env.ref("base.user_root"),
Copy link
Member

@etobella etobella Dec 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why do you change this. What is the problem of the current default of these fields?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the settings are configured by a regular user who does not wish to receive system notifications for every message, it is better not to add them automatically. Additionally, for the webhook user, Odoo follows a similar logic by using the Odoo bot user instead of the current user.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@etobella can you please check?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pedrobaeza I reviewed and it looked good for me, I just made a small suggestion, but we can continue with merge.

@pedrobaeza pedrobaeza added this to the 16.0 milestone Jan 3, 2025
Copy link
Member

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/ocabot merge minor

@OCA-git-bot
Copy link
Contributor

On my way to merge this fine PR!
Prepared branch 16.0-ocabot-merge-pr-1497-by-pedrobaeza-bump-minor, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 7cf36fa into OCA:16.0 Jan 3, 2025
7 of 9 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 8898100. Thanks a lot for contributing to OCA. ❤️

@pedrobaeza pedrobaeza deleted the 16.0-mail_gateway_whatsapp-add-templates branch January 3, 2025 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants