[IMP] crm_helpdesk :- call email.message.send.wizard in oprtunity instead of crm.send.mail wizard.
bzr revid: ysa@tinyerp.com-20110218112850-k9bpkg9v7rceixq7
This commit is contained in:
parent
dceabef2ac
commit
3e1b8764eb
|
@ -22,6 +22,7 @@
|
|||
from crm import crm
|
||||
from osv import fields, osv
|
||||
import time
|
||||
import tools
|
||||
|
||||
class crm_helpdesk(crm.crm_case, osv.osv):
|
||||
""" Helpdesk Cases """
|
||||
|
@ -86,6 +87,37 @@ class crm_helpdesk(crm.crm_case, osv.osv):
|
|||
'priority': lambda *a: crm.AVAILABLE_PRIORITIES[2][0],
|
||||
}
|
||||
|
||||
def action_send_email(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
Open Send email wizard.
|
||||
"""
|
||||
if context is None:
|
||||
context = {}
|
||||
for lead in self.browse(cr, uid ,ids, context):
|
||||
context.update({
|
||||
'mail':'new',
|
||||
'model': 'crm.lead',
|
||||
'default_name': lead.name,
|
||||
'default_email_to': lead.email_from,
|
||||
'default_email_from': lead.user_id and lead.user_id.address_id and lead.user_id.address_id.email,
|
||||
'default_description': '\n' + (tools.ustr(lead.user_id.signature or '')),
|
||||
'default_reply_to': lead.section_id and lead.section_id.reply_to or False,
|
||||
'default_model': context.get('model',''),
|
||||
'default_email_cc': tools.ustr(lead.email_cc or ''),
|
||||
'default_res_id': context.get('rec_id',0)
|
||||
})
|
||||
result = {
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form',
|
||||
'res_model': 'email.message.wizard_send',
|
||||
'view_id': False,
|
||||
'context': context,
|
||||
'type': 'ir.actions.act_window',
|
||||
'target': 'new',
|
||||
'nodestroy': True
|
||||
}
|
||||
return result
|
||||
|
||||
crm_helpdesk()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -100,11 +100,11 @@
|
|||
<tree string="History">
|
||||
<field name="display_text" string="History Information"/>
|
||||
<field name="history" invisible="1"/>
|
||||
<button
|
||||
string="Reply" attrs="{'invisible': [('history', '!=', True)]}"
|
||||
name="%(crm.action_crm_send_mail)d"
|
||||
context="{'mail':'reply', 'model': 'crm.helpdesk', 'include_original' : True}"
|
||||
icon="terp-mail-replied" type="action" />
|
||||
<button
|
||||
string="Reply" attrs="{'invisible': [('history', '!=', True)]}"
|
||||
name="%(emails.action_email_message_wizard_send)d"
|
||||
context="{'mail':'reply', 'model': 'crm.helpdesk', 'include_original' : True, 'message_id':active_id}"
|
||||
icon="terp-mail-replied" type="action" />
|
||||
</tree>
|
||||
<form string="History">
|
||||
<group col="4" colspan="4">
|
||||
|
@ -119,11 +119,10 @@
|
|||
<page string="Details">
|
||||
<group attrs="{'invisible': [('history', '!=', True)]}">
|
||||
<field name="description" colspan="4" nolabel="1" height="250"/>
|
||||
<button colspan="4"
|
||||
string="Reply"
|
||||
name="%(crm.action_crm_send_mail)d"
|
||||
context="{'mail':'reply', 'model': 'crm.helpdesk', 'include_original' : True}"
|
||||
icon="terp-mail-replied" type="action" />
|
||||
<button colspan="4" string="Reply"
|
||||
name="%(emails.action_email_message_wizard_send)d"
|
||||
context="{'mail':'reply', 'model': 'crm.helpdesk', 'include_original' : True, 'message_id':active_id}"
|
||||
icon="terp-mail-replied" type="action"/>
|
||||
</group>
|
||||
<group attrs="{'invisible': [('history', '=', True)]}">
|
||||
<field name="display_text" colspan="4" nolabel="1" height="250"/>
|
||||
|
@ -139,10 +138,10 @@
|
|||
name="%(crm.action_crm_add_note)d"
|
||||
context="{'model': 'crm.lead' }"
|
||||
icon="terp-document-new" type="action" />
|
||||
<button string="Send New Email"
|
||||
name="%(crm.action_crm_send_mail)d"
|
||||
context="{'mail':'new', 'model': 'crm.helpdesk'}"
|
||||
icon="terp-mail-message-new" type="action" />
|
||||
<button string="Send New Email"
|
||||
name="action_send_email"
|
||||
context="{'mail':'new', 'model': 'crm.helpdesk', 'rec_id' : active_id}"
|
||||
icon="terp-mail-message-new" type="object"/>
|
||||
</page>
|
||||
<page string="Extra Info" groups="base.group_extended">
|
||||
<group colspan="2" col="2">
|
||||
|
|
Loading…
Reference in New Issue