[REF] sale: get rid of 'Send email' context key
Purpose is to prepare improvements in emails sent in confirmation and payment. A context key forcing email used only once in the code is removed. Method used to send email is inlined. It allows to better understand flow. Related to task ID 1873634 Linked to PR #28781
This commit is contained in:
committed by
Thibault Delavallée
parent
b12ab8008b
commit
b55b4a42a6
@@ -87,7 +87,8 @@ class PaymentTransaction(models.Model):
|
||||
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.with_context(send_email=True).action_confirm()
|
||||
so.action_confirm()
|
||||
so.force_quotation_send()
|
||||
# invoice the sale orders if needed
|
||||
self._invoice_sale_orders()
|
||||
res = super(PaymentTransaction, self)._reconcile_after_transaction_done()
|
||||
|
||||
@@ -674,9 +674,6 @@ class SaleOrder(models.Model):
|
||||
This method should be extended when the confirmation should generated
|
||||
other documents. In this method, the SO are in 'sale' state (not yet 'done').
|
||||
"""
|
||||
if self.env.context.get('send_email'):
|
||||
self.force_quotation_send()
|
||||
|
||||
# create an analytic account if at least an expense product
|
||||
for order in self:
|
||||
if any([expense_policy not in [False, 'no'] for expense_policy in order.order_line.mapped('product_id.expense_policy')]):
|
||||
|
||||
Reference in New Issue
Block a user