From 69aae687fc15e0dd5de7ded9e61f11fddceb04ab Mon Sep 17 00:00:00 2001 From: "Andrea Grazioso (agr-odoo)" Date: Wed, 27 Jan 2021 16:09:03 +0000 Subject: [PATCH] [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 Signed-off-by: Jorge Pinna Puissant (jpp) --- addons/website_sale/models/sale_order.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addons/website_sale/models/sale_order.py b/addons/website_sale/models/sale_order.py index ec01b4afad7..fda4a7fcc38 100644 --- a/addons/website_sale/models/sale_order.py +++ b/addons/website_sale/models/sale_order.py @@ -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"