diff --git a/addons/crm/__openerp__.py b/addons/crm/__openerp__.py
index d1500850afb..a6e42dd211e 100644
--- a/addons/crm/__openerp__.py
+++ b/addons/crm/__openerp__.py
@@ -83,7 +83,7 @@ Create dashboard for CRM that includes:
'wizard/crm_opportunity_to_phonecall_view.xml',
'wizard/crm_partner_to_opportunity_view.xml',
- 'wizard/crm_send_email_view.xml',
+# 'wizard/crm_send_email_view.xml',
'wizard/crm_add_note_view.xml',
'wizard/crm_merge_opportunities_view.xml',
diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml
index d95b79139a6..a7479b8cdef 100644
--- a/addons/crm/crm_lead_view.xml
+++ b/addons/crm/crm_lead_view.xml
@@ -207,9 +207,9 @@
context="{'model': 'crm.lead' }"
icon="terp-document-new" type="action" />
+ name="%(emails.action_email_message_wizard_send)d"
+ context="{'mail':'new', 'model': 'crm.lead', 'record_id' : active_id}"
+ icon="terp-mail-message-new" type="action"/>
diff --git a/addons/crm/wizard/__init__.py b/addons/crm/wizard/__init__.py
index 9730b8d1d55..5a2adaa7e26 100644
--- a/addons/crm/wizard/__init__.py
+++ b/addons/crm/wizard/__init__.py
@@ -19,7 +19,7 @@
#
##############################################################################
-import crm_send_email
+#import crm_send_email
import crm_add_note
import crm_lead_to_partner
diff --git a/addons/crm_claim/crm_claim.py b/addons/crm_claim/crm_claim.py
index e33582e6659..bd755a5ccf1 100644
--- a/addons/crm_claim/crm_claim.py
+++ b/addons/crm_claim/crm_claim.py
@@ -100,38 +100,6 @@ 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',
- '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_model': context.get('model',''),
- 'default_email_cc': tools.ustr(data.email_cc or ''),
- 'default_res_id': context.get('rec_id',0)
- })
- if hasattr(data, 'section_id'):
- context.update({'default_reply_to': data.section_id and data.section_id.reply_to or False})
-
- 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
diff --git a/addons/crm_claim/crm_claim_view.xml b/addons/crm_claim/crm_claim_view.xml
index a8e8f017561..950dcf7bd26 100644
--- a/addons/crm_claim/crm_claim_view.xml
+++ b/addons/crm_claim/crm_claim_view.xml
@@ -75,15 +75,10 @@
-
-
-
-
-
@@ -203,9 +198,9 @@
context="{'model': 'crm.lead' }"
icon="terp-document-new" type="action" />
+ name="%(emails.action_email_message_wizard_send)d"
+ context="{'mail':'new', 'model': 'crm.claim', 'record_id' : active_id}"
+ icon="terp-mail-message-new" type="action"/>
diff --git a/addons/crm_fundraising/crm_fundraising.py b/addons/crm_fundraising/crm_fundraising.py
index c13089b07a6..6550da1c144 100644
--- a/addons/crm_fundraising/crm_fundraising.py
+++ b/addons/crm_fundraising/crm_fundraising.py
@@ -94,38 +94,6 @@ class crm_fundraising(crm.crm_case, osv.osv):
'planned_revenue': lambda *a:0.0,
}
- 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',
- '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_model': context.get('model',''),
- 'default_email_cc': tools.ustr(data.email_cc or ''),
- 'default_res_id': context.get('rec_id',0)
- })
- if hasattr(data, 'section_id'):
- context.update({'default_reply_to': data.section_id and data.section_id.reply_to or False})
-
- 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_fundraising()
diff --git a/addons/crm_fundraising/crm_fundraising_view.xml b/addons/crm_fundraising/crm_fundraising_view.xml
index fde8905f5b3..bd454a266a1 100644
--- a/addons/crm_fundraising/crm_fundraising_view.xml
+++ b/addons/crm_fundraising/crm_fundraising_view.xml
@@ -187,9 +187,9 @@
context="{'model': 'crm.lead' }"
icon="terp-document-new" type="action" />
+ name="%(emails.action_email_message_wizard_send)d"
+ context="{'mail':'new', 'model': 'crm.fundraising', 'record_id' : active_id}"
+ icon="terp-mail-message-new" type="action"/>
diff --git a/addons/crm_helpdesk/crm_helpdesk.py b/addons/crm_helpdesk/crm_helpdesk.py
index 3d31c6b241f..7e98cdf6398 100644
--- a/addons/crm_helpdesk/crm_helpdesk.py
+++ b/addons/crm_helpdesk/crm_helpdesk.py
@@ -87,38 +87,6 @@ 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 data in self.browse(cr, uid ,ids, context):
- context.update({
- 'mail':'new',
- '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_model': context.get('model',''),
- 'default_email_cc': tools.ustr(data.email_cc or ''),
- 'default_res_id': context.get('rec_id',0)
- })
- if hasattr(data, 'section_id'):
- context.update({'default_reply_to': data.section_id and data.section_id.reply_to or False})
-
- 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:
diff --git a/addons/crm_helpdesk/crm_helpdesk_view.xml b/addons/crm_helpdesk/crm_helpdesk_view.xml
index 02635b07097..266e72e261c 100644
--- a/addons/crm_helpdesk/crm_helpdesk_view.xml
+++ b/addons/crm_helpdesk/crm_helpdesk_view.xml
@@ -139,9 +139,9 @@
context="{'model': 'crm.lead' }"
icon="terp-document-new" type="action" />
+ name="%(emails.action_email_message_wizard_send)d"
+ context="{'mail':'new', 'model': 'crm.helpdesk', 'record_id' : active_id}"
+ icon="terp-mail-message-new" type="action"/>
diff --git a/addons/emails/wizard/email_message_wizard_send.py b/addons/emails/wizard/email_message_wizard_send.py
index dfd310732c3..d02a53f9cc7 100644
--- a/addons/emails/wizard/email_message_wizard_send.py
+++ b/addons/emails/wizard/email_message_wizard_send.py
@@ -34,11 +34,36 @@ class email_message_wizard_send(osv.osv_memory):
context = {}
result = super(email_message_wizard_send, self).default_get(cr, uid, fields, context=context)
message_pool = self.pool.get('email.message')
-
- model_pool = self.pool.get('ir.model')
message_id = context.get('message_id', False)
message_data = False
- if message_id:
+ if context.get('record_id',False) and context.get('model',False):
+ model_obj = self.pool.get(context.get('model'))
+ data = model_obj.browse(cr, uid ,context.get('record_id'), context)
+ if 'name' in fields:
+ result['name'] = data.name
+
+ if 'email_to' in fields:
+ result['email_to'] = data.email_from
+
+ if 'email_from' in fields:
+ result['email_from'] = data.user_id and data.user_id.address_id and data.user_id.address_id.email
+
+ if 'description' in fields:
+ result['description'] = '\n' + (tools.ustr(data.user_id.signature or ''))
+
+ if 'model' in fields:
+ result['model'] = context.get('model','')
+
+ if 'email_cc' in fields:
+ result['email_cc'] = tools.ustr(data.email_cc or '')
+
+ if 'res_id' in fields:
+ result['res_id'] = context.get('record_id',0)
+
+ if 'reply_to' in fields and hasattr(data, 'section_id'):
+ result['reply_to'] = data.section_id and data.section_id.reply_to or False
+
+ elif message_id:
message_data = message_pool.browse(cr, uid, int(message_id), context)
if 'template_id' in fields:
result['template_id'] = message_data and message_data.template_id and message_data.template_id.id or False
diff --git a/addons/event/event.py b/addons/event/event.py
index b47b9eb7690..bd05ef5c8db 100644
--- a/addons/event/event.py
+++ b/addons/event/event.py
@@ -335,38 +335,6 @@ class event_registration(osv.osv):
'user_id': lambda self, cr, uid, ctx: uid,
}
- 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',
- '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_model': context.get('model',''),
- 'default_email_cc': tools.ustr(data.email_cc or ''),
- 'default_res_id': context.get('rec_id',0)
- })
- if hasattr(data, 'section_id'):
- context.update({'default_reply_to': data.section_id and data.section_id.reply_to or False})
-
- 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 _make_invoice(self, cr, uid, reg, lines, context=None):
""" Create Invoice from Invoice lines
@param reg: Model of Event Registration
diff --git a/addons/event/event_view.xml b/addons/event/event_view.xml
index d29db1bd800..1954c8e7294 100644
--- a/addons/event/event_view.xml
+++ b/addons/event/event_view.xml
@@ -430,9 +430,9 @@
context="{'model': 'crm.lead' }"
icon="terp-document-new" type="action" />
+ name="%(emails.action_email_message_wizard_send)d"
+ context="{'mail':'new', 'model': 'event.registration', 'record_id' : active_id}"
+ icon="terp-mail-message-new" type="action"/>
diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py
index 4eb4fe16995..27e6b468682 100644
--- a/addons/hr_recruitment/hr_recruitment.py
+++ b/addons/hr_recruitment/hr_recruitment.py
@@ -176,38 +176,6 @@ class hr_applicant(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 data in self.browse(cr, uid ,ids, context):
- context.update({
- 'mail':'new',
- '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_model': context.get('model',''),
- 'default_email_cc': tools.ustr(data.email_cc or ''),
- 'default_res_id': context.get('rec_id',0)
- })
- if hasattr(data, 'section_id'):
- context.update({'default_reply_to': data.section_id and data.section_id.reply_to or False})
-
- 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_job(self,cr, uid, ids, job, context=None):
result = {}
diff --git a/addons/hr_recruitment/hr_recruitment_view.xml b/addons/hr_recruitment/hr_recruitment_view.xml
index b0c320468df..bdba2fd2fed 100644
--- a/addons/hr_recruitment/hr_recruitment_view.xml
+++ b/addons/hr_recruitment/hr_recruitment_view.xml
@@ -184,9 +184,9 @@
context="{'model': 'crm.lead' }"
icon="terp-document-new" type="action" />
+ name="%(emails.action_email_message_wizard_send)d"
+ context="{'mail':'new', 'model': 'hr.applicant', 'record_id' : active_id}"
+ icon="terp-mail-message-new" type="action"/>
diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py
index 227ba4f617d..9e82eb01556 100644
--- a/addons/project_issue/project_issue.py
+++ b/addons/project_issue/project_issue.py
@@ -243,38 +243,6 @@ class project_issue(crm.crm_case, osv.osv):
'project_id':_get_project,
}
- 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',
- '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_model': context.get('model',''),
- 'default_email_cc': tools.ustr(data.email_cc or ''),
- 'default_res_id': context.get('rec_id',0)
- })
- if hasattr(data, 'section_id'):
- context.update({'default_reply_to': data.section_id and data.section_id.reply_to or False})
-
- 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 convert_issue_task(self, cr, uid, ids, context=None):
case_obj = self.pool.get('project.issue')
data_obj = self.pool.get('ir.model.data')
diff --git a/addons/project_issue/project_issue_view.xml b/addons/project_issue/project_issue_view.xml
index c17002d969d..a0bb2a82898 100644
--- a/addons/project_issue/project_issue_view.xml
+++ b/addons/project_issue/project_issue_view.xml
@@ -141,9 +141,9 @@
context="{'model': 'crm.lead' }"
icon="terp-document-new" type="action" />
+ name="%(emails.action_email_message_wizard_send)d"
+ context="{'mail':'new', 'model': 'project.issue', 'record_id' : active_id}"
+ icon="terp-mail-message-new" type="action"/>