[FIX] website_sale: use email template email from for confirmation email
The email_from for the order confirmation email in the ecommerce was forced to the company email, preventing any customisation concerning the from email address in the sale order mail template.
This commit is contained in:
parent
35806cc075
commit
67443b5b17
|
@ -802,13 +802,20 @@ class website_sale(http.Controller):
|
|||
|
||||
# send the email
|
||||
if email_act and email_act.get('context'):
|
||||
composer_obj = request.registry['mail.compose.message']
|
||||
composer_values = {}
|
||||
email_ctx = email_act['context']
|
||||
public_id = request.website.user_id.id
|
||||
if uid == public_id:
|
||||
template_values = [
|
||||
email_ctx.get('default_template_id'),
|
||||
email_ctx.get('default_composition_mode'),
|
||||
email_ctx.get('default_model'),
|
||||
email_ctx.get('default_res_id'),
|
||||
]
|
||||
composer_values.update(composer_obj.onchange_template_id(cr, SUPERUSER_ID, None, *template_values, context=context).get('value', {}))
|
||||
if not composer_values.get('email_from') and uid == request.website.user_id.id:
|
||||
composer_values['email_from'] = request.website.user_id.company_id.email
|
||||
composer_id = request.registry['mail.compose.message'].create(cr, SUPERUSER_ID, composer_values, context=email_ctx)
|
||||
request.registry['mail.compose.message'].send_mail(cr, SUPERUSER_ID, [composer_id], context=email_ctx)
|
||||
composer_id = composer_obj.create(cr, SUPERUSER_ID, composer_values, context=email_ctx)
|
||||
composer_obj.send_mail(cr, SUPERUSER_ID, [composer_id], context=email_ctx)
|
||||
|
||||
# clean context and session, then redirect to the confirmation page
|
||||
request.website.sale_reset(context=context)
|
||||
|
|
Loading…
Reference in New Issue