[FIX] account_product_template: handle attachments of the template.

bzr revid: tde@openerp.com-20140124110012-lpf79nvmcqjhzuvv
This commit is contained in:
Thibault Delavallée 2014-01-24 12:00:12 +01:00
parent 9478019191
commit e374abeba6
1 changed files with 5 additions and 4 deletions

View File

@ -24,10 +24,11 @@ class account_invoice(osv.Model):
'template_id': line.product_id.email_template_id.id,
'composition_mode': 'comment',
}, context=context)
Composer.write(
cr, uid, [composer_id],
Composer.onchange_template_id(cr, uid, composer_id, line.product_id.email_template_id.id, 'comment', 'account.invoice', invoice.id)['value']
)
template_values = Composer.onchange_template_id(
cr, uid, composer_id, line.product_id.email_template_id.id, 'comment', 'account.invoice', invoice.id
)['value']
template_values['attachment_ids'] = [(4, id) for id in template_values.get('attachment_ids', '[]')]
Composer.write(cr, uid, [composer_id], template_values, context=context)
Composer.send_mail(cr, uid, [composer_id], context=context)
return True