Skip to content
Snippets Groups Projects
Commit 7831fe63 authored by Denis Ledoux's avatar Denis Ledoux
Browse files

[FIX] email_template: default model for save as new template feature

When sending a message with the "Compose new message" button on the right of the user menu, in the top bar, if you tried to save the message as template, you had a traceback because model field of email.template is mandatory, but was set to True because there is no model in such a case.

As there is no any relevant model in such a place, and that the field is mandatory, mail.message is pretty convenient as the default value.
parent 276d0e76
No related branches found
No related tags found
No related merge requests found
......@@ -131,7 +131,7 @@ class mail_compose_message(osv.TransientModel):
email_template = self.pool.get('email.template')
ir_model_pool = self.pool.get('ir.model')
for record in self.browse(cr, uid, ids, context=context):
model_ids = ir_model_pool.search(cr, uid, [('model', '=', record.model)], context=context)
model_ids = ir_model_pool.search(cr, uid, [('model', '=', record.model or 'mail.message')], context=context)
model_id = model_ids and model_ids[0] or False
model_name = ''
if model_id:
......
......@@ -29,7 +29,7 @@
<div>Use template
<!--FIX: To avoid css issue of many2one field in footer temporary used oe_form (BUG:1152464)-->
<field name="template_id" nolabel="1" class='oe_inline'
on_change="onchange_template_id(template_id, composition_mode, model, res_id, context)" domain="[('model_id.model','=',model)]"
on_change="onchange_template_id(template_id, composition_mode, model, res_id, context)" domain="[('model_id.model','=',model or 'mail.message')]"
context="{'default_model': model, 'default_body_html': body, 'default_subject': subject}"/>
</div>
<button icon="/email_template/static/src/img/email_template_save.png"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment