[FIX] website_sale: send confirmation email when no amount

As user access the ecommerce and add to cart a free product (0$ total)
Checkout and Confirm
No email will be sent for confirmation

This occur because the confirmation email is normally sent in the
transaction callback, which is not created when the amount is 0

opw-2440335

closes odoo/odoo#65235

X-original-commit: ed3e69df1564eca3becdc57181608bc0211ca4c5
Signed-off-by: agr-odoo <agr-odoo@users.noreply.github.com>
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
This commit is contained in:
Andrea Grazioso (agr-odoo)
2021-01-28 17:33:23 +00:00
parent 193fee519c
commit 69aae687fc
+7
View File
@@ -353,6 +353,13 @@ class SaleOrder(models.Model):
sent_orders |= order
sent_orders.write({'cart_recovery_email_sent': True})
def action_confirm(self):
res = super(SaleOrder, self).action_confirm()
for order in self:
if not order.transaction_ids and not order.amount_total and self._context.get('send_email'):
order._send_order_confirmation_mail()
return res
class SaleOrderLine(models.Model):
_inherit = "sale.order.line"