From e374abeba61df8290f3634146014ac726d8185de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Fri, 24 Jan 2014 12:00:12 +0100 Subject: [PATCH] [FIX] account_product_template: handle attachments of the template. bzr revid: tde@openerp.com-20140124110012-lpf79nvmcqjhzuvv --- addons/account_product_template/models/invoice.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/addons/account_product_template/models/invoice.py b/addons/account_product_template/models/invoice.py index 7249e4e61ec..d9e82e42012 100644 --- a/addons/account_product_template/models/invoice.py +++ b/addons/account_product_template/models/invoice.py @@ -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