[FIX] email.compose.message: set signature and auto_delete on change of template
bzr revid: rha@tinyerp.com-20110413113633-un3xkrbhlfaof585
This commit is contained in:
parent
a353b5e927
commit
e2c7bfc88c
|
@ -139,12 +139,15 @@ class email_compose_message(osv.osv_memory):
|
|||
vals.update(self.get_template_data(cr, uid, resource_id, template_id, context))
|
||||
else:
|
||||
vals.update({'attachment_ids' : []})
|
||||
|
||||
email_temp_pool = self.pool.get('email.template')
|
||||
if context.get('active_model') and context.get('active_id') and email_temp_pool.browse(cr, uid, template_id, context=context).user_signature:
|
||||
template_data = email_temp_pool.browse(cr, uid, template_id, context=context)
|
||||
vals.update({'auto_delete': template_data.auto_delete})
|
||||
if context.get('active_model') and context.get('active_id') and template_data.user_signature:
|
||||
model_pool = self.pool.get(context['active_model'])
|
||||
user = model_pool.browse(cr, uid, context['active_id'], context=context).user_id
|
||||
signature = user and user.signature
|
||||
vals['body'] = _('%s\n%s') %(vals['body'], signature or '')
|
||||
signature = user and user.signature or ''
|
||||
vals['body'] = vals['body'] + '\n' + signature
|
||||
return {'value': vals}
|
||||
|
||||
email_compose_message()
|
||||
|
|
|
@ -207,7 +207,8 @@ class email_compose_message(osv.osv_memory):
|
|||
email_id = email_message_pool.schedule_with_attach(cr, uid, mail.email_from, mail.email_to, mail.subject, mail.body,
|
||||
model=mail.model, email_cc=mail.email_cc, email_bcc=mail.email_bcc, reply_to=mail.reply_to,
|
||||
attach=attachment, message_id=message_id, references=references, openobject_id=int(mail.res_id),
|
||||
subtype=mail.sub_type, x_headers=mail.headers, priority=mail.priority, smtp_server_id=mail.smtp_server_id and mail.smtp_server_id.id, context=context)
|
||||
subtype=mail.sub_type, x_headers=mail.headers, priority=mail.priority, smtp_server_id=mail.smtp_server_id and mail.smtp_server_id.id,
|
||||
auto_delete=mail.auto_delete or False, context=context)
|
||||
email_ids.append(email_id)
|
||||
return email_ids
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
<field name="email_bcc" colspan="4"/>
|
||||
<field name="reply_to" colspan="4"/>
|
||||
<field name="subject" colspan="4" widget="char" size="512"/>
|
||||
<field name="auto_delete" colspan="4" invisible="1"/>
|
||||
</group>
|
||||
<separator string="" colspan="4"/>
|
||||
<notebook colspan="4">
|
||||
|
|
Loading…
Reference in New Issue