diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index 42d42e7ec1b..ef2ffc5cdbe 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -395,18 +395,23 @@ class account_invoice(osv.osv): template_id = template and template[1] or False res = mod_obj.get_object_reference(cr, uid, 'mail', 'email_compose_message_wizard_form') res_id = res and res[1] or False - ctx = dict(context, active_model='account.invoice', active_id=ids[0]) - ctx.update({'mail.compose.template_id': template_id}) + ctx = dict(context) + ctx.update({ + 'default_model': 'account.invoice', + 'default_res_id': ids[0], + 'default_use_template': True, + 'default_template_id': template_id, + }) return { - 'view_type': 'form', - 'view_mode': 'form', - 'res_model': 'mail.compose.message', - 'views': [(res_id, 'form')], - 'view_id': res_id, - 'type': 'ir.actions.act_window', - 'target': 'new', - 'context': ctx, - 'nodestroy': True, + 'view_type': 'form', + 'view_mode': 'form', + 'res_model': 'mail.compose.message', + 'views': [(res_id, 'form')], + 'view_id': res_id, + 'type': 'ir.actions.act_window', + 'target': 'new', + 'context': ctx, + 'nodestroy': True, } def confirm_paid(self, cr, uid, ids, context=None): diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 592bf783a64..1f6279af3ad 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -347,13 +347,18 @@ class purchase_order(osv.osv): template_id = template and template[1] or False res = mod_obj.get_object_reference(cr, uid, 'mail', 'email_compose_message_wizard_form') res_id = res and res[1] or False - ctx = dict(context, active_model='purchase.order', active_id=ids[0]) - ctx.update({'mail.compose.template_id': template_id}) + ctx = dict(context) + ctx.update({ + 'default_model': 'purchase.order', + 'default_res_id': ids[0], + 'default_use_template': True, + 'default_template_id': template_id, + }) return { 'view_type': 'form', 'view_mode': 'form', 'res_model': 'mail.compose.message', - 'views': [(res_id,'form')], + 'views': [(res_id, 'form')], 'view_id': res_id, 'type': 'ir.actions.act_window', 'target': 'new',