[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.
This commit is contained in:
parent
276d0e76b2
commit
7831fe631a
|
@ -131,7 +131,7 @@ class mail_compose_message(osv.TransientModel):
|
||||||
email_template = self.pool.get('email.template')
|
email_template = self.pool.get('email.template')
|
||||||
ir_model_pool = self.pool.get('ir.model')
|
ir_model_pool = self.pool.get('ir.model')
|
||||||
for record in self.browse(cr, uid, ids, context=context):
|
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_id = model_ids and model_ids[0] or False
|
||||||
model_name = ''
|
model_name = ''
|
||||||
if model_id:
|
if model_id:
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
<div>Use template
|
<div>Use template
|
||||||
<!--FIX: To avoid css issue of many2one field in footer temporary used oe_form (BUG:1152464)-->
|
<!--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'
|
<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}"/>
|
context="{'default_model': model, 'default_body_html': body, 'default_subject': subject}"/>
|
||||||
</div>
|
</div>
|
||||||
<button icon="/email_template/static/src/img/email_template_save.png"
|
<button icon="/email_template/static/src/img/email_template_save.png"
|
||||||
|
|
Loading…
Reference in New Issue