[FIX] purchase, account: updated call to mail.compose.message form view, using default values for the form.

bzr revid: tde@openerp.com-20120911141650-krnq836afvwmpln2
This commit is contained in:
Thibault Delavallée 2012-09-11 16:16:50 +02:00
parent cd4c6756bf
commit f0a792c565
2 changed files with 24 additions and 14 deletions

View File

@ -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):

View File

@ -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',