Skip to content
Snippets Groups Projects
Commit cd9b4732 authored by Nasreddin Boulif (bon)'s avatar Nasreddin Boulif (bon)
Browse files

[FIX] [sale_]loyalty: send gift card mail directly on SO confirmation


Steps to reproduce:

- Install Loyalty module
- Go to Website and buy a gift card
- Checkout and pay the order

Issue:

  Only 'Order Confirmation' email is sent directly to the customer,
  gift card email is queued and sent later.

Cause:

  `send_email` method is called with `force_send=False` by default,
  which queues the email to be sent later.

Solution:

  Add optional parameter `send_force` (default to `False`) to
  `_send_creation_communication` method and call it with
  `send_force=True` when confirming a sale order.

opw-3324386

closes odoo/odoo#133427

Signed-off-by: default avatarNasreddin Boulif (bon) <bon@odoo.com>
parent 3982de16
No related branches found
No related tags found
No related merge requests found
......@@ -100,7 +100,7 @@ class LoyaltyCard(models.Model):
'context': ctx,
}
def _send_creation_communication(self):
def _send_creation_communication(self, force_send=False):
"""
Sends the 'At Creation' communication plan if it exist for the given coupons.
"""
......@@ -114,7 +114,7 @@ class LoyaltyCard(models.Model):
if not create_comm_per_program[coupon.program_id] or not coupon._get_mail_partner():
continue
for comm in create_comm_per_program[coupon.program_id]:
comm.mail_template_id.send_mail(res_id=coupon.id, email_layout_xmlid='mail.mail_notification_light')
comm.mail_template_id.send_mail(res_id=coupon.id, force_send=force_send, email_layout_xmlid='mail.mail_notification_light')
def _send_points_reach_communication(self, points_changes):
"""
......
......@@ -107,7 +107,7 @@ class SaleOrder(models.Model):
for order in self:
coupons |= order._get_reward_coupons()
if coupons:
coupons._send_creation_communication()
coupons._send_creation_communication(force_send=True)
def _get_applied_global_discount_lines(self):
"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment