[FIX] websiste_sale: order confirmation email with attachment

This rev. is related to 67443b5b17

onchange_template_id returns the attachment_ids as a id list,
not as a *2many command list
The conversion from id list to command list has to be done manually.

At the moment, attachment_ids is the only 2many fields of email.template
This commit is contained in:
Denis Ledoux 2015-02-04 17:02:07 +01:00
parent bcf8254c16
commit b36908b6f8
1 changed files with 2 additions and 0 deletions

View File

@ -817,6 +817,8 @@ class website_sale(http.Controller):
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
if composer_values.get('attachment_ids'):
composer_values['attachment_ids'] = [(6, 0, composer_values['attachment_ids'])]
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)