diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py
index b463e379a6e..c45a18b7ddc 100644
--- a/addons/crm/crm_lead.py
+++ b/addons/crm/crm_lead.py
@@ -294,19 +294,20 @@ class crm_lead(crm_case, osv.osv):
"""
if context is None:
context = {}
- for lead in self.browse(cr, uid ,ids, context):
+ for data 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_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(lead.email_cc or ''),
+ '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',
diff --git a/addons/crm_claim/crm_claim.py b/addons/crm_claim/crm_claim.py
index 3626a843545..e33582e6659 100644
--- a/addons/crm_claim/crm_claim.py
+++ b/addons/crm_claim/crm_claim.py
@@ -109,16 +109,17 @@ class crm_claim(crm.crm_case, osv.osv):
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)
})
+ 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',
diff --git a/addons/crm_fundraising/crm_fundraising.py b/addons/crm_fundraising/crm_fundraising.py
index 89881b21d98..c13089b07a6 100644
--- a/addons/crm_fundraising/crm_fundraising.py
+++ b/addons/crm_fundraising/crm_fundraising.py
@@ -100,19 +100,20 @@ class crm_fundraising(crm.crm_case, osv.osv):
"""
if context is None:
context = {}
- for lead in self.browse(cr, uid ,ids, context):
+ for data 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_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(lead.email_cc or ''),
+ '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',
diff --git a/addons/crm_helpdesk/crm_helpdesk.py b/addons/crm_helpdesk/crm_helpdesk.py
index adf6bc1d2a6..3d31c6b241f 100644
--- a/addons/crm_helpdesk/crm_helpdesk.py
+++ b/addons/crm_helpdesk/crm_helpdesk.py
@@ -93,19 +93,20 @@ class crm_helpdesk(crm.crm_case, osv.osv):
"""
if context is None:
context = {}
- for lead in self.browse(cr, uid ,ids, context):
+ for data 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_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(lead.email_cc or ''),
+ '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',
diff --git a/addons/event/event.py b/addons/event/event.py
index 68414f7d0f7..b47b9eb7690 100644
--- a/addons/event/event.py
+++ b/addons/event/event.py
@@ -341,19 +341,20 @@ class event_registration(osv.osv):
"""
if context is None:
context = {}
- for lead in self.browse(cr, uid ,ids, context):
+ for data 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_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(lead.email_cc or ''),
+ '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',
diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py
index 27e6b468682..4eb4fe16995 100644
--- a/addons/hr_recruitment/hr_recruitment.py
+++ b/addons/hr_recruitment/hr_recruitment.py
@@ -176,6 +176,38 @@ 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 3738a1d8be6..b0c320468df 100644
--- a/addons/hr_recruitment/hr_recruitment_view.xml
+++ b/addons/hr_recruitment/hr_recruitment_view.xml
@@ -145,11 +145,11 @@