[IMP] crm_claim :- call email.message.send.wizard in oprtunity instead of crm.send.mail wizard.

bzr revid: ysa@tinyerp.com-20110218111736-csyf3cgc51biy8az
This commit is contained in:
Yogesh (OpenERP) 2011-02-18 16:47:36 +05:30
parent de37cd5b35
commit c3c9ce4621
3 changed files with 52 additions and 21 deletions

View File

@ -209,7 +209,7 @@
<button string="Send New Email"
name="action_send_email"
context="{'mail':'new', 'model': 'crm.lead', 'rec_id' : active_id}"
icon="terp-mail-message-new" type="object" />
icon="terp-mail-message-new" type="object"/>
</page>
</notebook>
</form>

View File

@ -22,6 +22,7 @@
from osv import fields, osv
from crm import crm
import time
import tools
class crm_claim(crm.crm_case, osv.osv):
"""
@ -99,6 +100,37 @@ class crm_claim(crm.crm_case, osv.osv):
#'stage_id': _get_stage_id,
}
def action_send_email(self, cr, uid, ids, context=None):
"""
Open Send email wizard.
"""
if context is None:
context = {}
for data in self.browse(cr, uid ,ids, context):
context.update({
'mail':'new',
'model': 'crm.lead',
'default_name': data.name,
'default_email_to': data.email_from,
'default_email_from': data.user_id and data.user_id.address_id and data.user_id.address_id.email,
'default_description': '\n' + (tools.ustr(data.user_id.signature or '')),
'default_reply_to': data.section_id and data.section_id.reply_to or False,
'default_model': context.get('model',''),
'default_email_cc': tools.ustr(data.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
def onchange_partner_id(self, cr, uid, ids, part, email=False):
"""This function returns value of partner address based on partner
@param self: The object pointer

View File

@ -33,7 +33,7 @@
<field name="context">{'type':'claim'}</field>
<field name="help">You can create claim stages to categorize the status of every claim entered in the system. The stages define all the steps required for the resolution of a claim.</field>
</record>
<menuitem action="crm_claim_stage_act" name="Stages"
id="menu_crm_claim_stage_act" parent="menu_config_claim" />
@ -75,15 +75,15 @@
<group>
<field name="name" />
<field name="date"/>
</group>
<group colspan="4" col="6">
<field name="user_id"/>
<field name="section_id" widget="selection" />
<group colspan="2" col="4">
<field name="stage_id" domain="[('type','=','claim')]"/>
<button name="stage_previous" string="" type="object" icon="gtk-go-back" />
@ -164,11 +164,11 @@
<field name="message_ids" colspan="4" nolabel="1" mode="tree,form">
<tree string="History">
<field name="display_text" string="History Information"/>
<button
string="Reply"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.claim', 'include_original' : True}"
icon="terp-mail-replied" type="action" attrs="{'invisible': [('history', '!=', True)]}" />
<button
string="Reply" attrs="{'invisible': [('history', '!=', True)]}"
name="%(emails.action_email_message_wizard_send)d"
context="{'mail':'reply', 'model': 'crm.claim', 'include_original' : True, 'message_id':active_id}"
icon="terp-mail-replied" type="action" />
</tree>
<form string="Communication &amp; History">
<group col="4" colspan="4">
@ -183,11 +183,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.claim', '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.claim', '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"/>
@ -203,10 +202,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.claim'}"
icon="terp-mail-message-new" type="action" />
<button string="Send New Email"
name="action_send_email"
context="{'mail':'new', 'model': 'crm.claim', 'rec_id' : active_id}"
icon="terp-mail-message-new" type="object"/>
</page>
</notebook>
</group>