[FIX] sale: correctly propagate contexts
Commit d139e92c62 set the force_send to True
unless there is an explicit mail_notify_force_send set to False in the context.
The _get_eval_context puts mail_notify_force_send to False in the context,
but it might be lost before reaching that method call.
Launch a cron that starts a transaction, see if it goes through,
and rollback if it didn't,
then the mails send inbetween will be sent every time the cron restarts.
E.g. _cron_post_process_after_done.
opw 1921112
opw 1945953
closes odoo/odoo#31605
Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
This commit is contained in:
@@ -112,7 +112,7 @@ class PaymentTransaction(models.Model):
|
||||
ctx_company = {'company_id': self.acquirer_id.company_id.id,
|
||||
'force_company': self.acquirer_id.company_id.id}
|
||||
for trans in self.filtered(lambda t: t.sale_order_ids):
|
||||
trans = trans.with_context(ctx_company)
|
||||
trans = trans.with_context(**ctx_company)
|
||||
trans.sale_order_ids._force_lines_to_invoice_policy_order()
|
||||
invoices = trans.sale_order_ids.action_invoice_create()
|
||||
trans.invoice_ids = [(6, 0, invoices)]
|
||||
|
||||
@@ -651,7 +651,7 @@ class SaleOrder(models.Model):
|
||||
if email_act and email_act.get('context'):
|
||||
email_ctx = email_act['context']
|
||||
email_ctx.update(default_email_from=order.company_id.email)
|
||||
order.with_context(email_ctx).message_post_with_template(email_ctx.get('default_template_id'))
|
||||
order.with_context(**email_ctx).message_post_with_template(email_ctx.get('default_template_id'))
|
||||
return True
|
||||
|
||||
@api.multi
|
||||
|
||||
Reference in New Issue
Block a user