summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien (juc) Castiaux <juc@odoo.com>2018-10-16 12:33:34 +0000
committerJulien (juc) Castiaux <juc@odoo.com>2018-10-17 09:18:49 +0000
commit6e97e354d80455f75458aa4f3d802bfb632d9df0 (patch)
treee502a152061ed3976073d81bc39f514c35c0759d
parent89b15b6d8759e3b505c447837d41dff1832c2b34 (diff)
[FIX] sale: Wrong email state for order confirmation
The email sent after an electronic payment is sent using the quotation template instead of the order template. This PR changes the way payment are done in the backend so the order has the correct state before sending the email. opw-1894258 closes odoo/odoo#27847
-rw-r--r--addons/sale/models/payment.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/addons/sale/models/payment.py b/addons/sale/models/payment.py
index 9405adc1e9f..ac5f92df2de 100644
--- a/addons/sale/models/payment.py
+++ b/addons/sale/models/payment.py
@@ -86,12 +86,10 @@ class PaymentTransaction(models.Model):
def _reconcile_after_transaction_done(self):
# Override of '_set_transaction_done' in the 'payment' module
# to confirm the quotations automatically and to generate the invoices if needed.
- sales_orders = self.mapped('sale_order_ids').filtered(lambda so: so.state == 'draft')
- sales_orders.force_quotation_send()
- sales_orders = self.mapped('sale_order_ids').filtered(lambda so: so.state == 'sent')
+ sales_orders = self.mapped('sale_order_ids').filtered(lambda so: so.state in ('draft', 'sent'))
for so in sales_orders:
# For loop because some override of action_confirm are ensure_one.
- so.action_confirm()
+ so.with_context(send_email=True).action_confirm()
# invoice the sale orders if needed
self._invoice_sale_orders()
res = super(PaymentTransaction, self)._reconcile_after_transaction_done()