[IMP] email.compose.message :- improve context value in related module.
bzr revid: ysa@tinyerp.com-20110222050737-hq5uv88etuu06yow
This commit is contained in:
@@ -171,7 +171,7 @@
|
||||
<button
|
||||
string="Reply" attrs="{'invisible': [('history', '!=', True)]}"
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'reply', 'model': 'crm.lead', 'include_original' : True, 'message_id':active_id}"
|
||||
context="{'mail':'reply', 'message_id':active_id}"
|
||||
icon="terp-mail-replied" type="action" />
|
||||
</tree>
|
||||
<form string="Communication history">
|
||||
@@ -189,7 +189,7 @@
|
||||
<field name="description" colspan="4" nolabel="1" height="250"/>
|
||||
<button colspan="4" string="Reply"
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'reply', 'model': 'crm.lead', 'include_original' : True, 'message_id':active_id}"
|
||||
context="{'mail':'reply', 'message_id':active_id}"
|
||||
icon="terp-mail-replied" type="action"/>
|
||||
</group>
|
||||
<group attrs="{'invisible': [('history', '=', True)]}">
|
||||
@@ -208,7 +208,7 @@
|
||||
icon="terp-document-new" type="action" />
|
||||
<button string="Send New Email"
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'new', 'model': 'crm.lead', 'record_id' : active_id}"
|
||||
context="{'mail':'new'}"
|
||||
icon="terp-mail-message-new" type="action"/>
|
||||
</page>
|
||||
</notebook>
|
||||
|
||||
@@ -156,7 +156,7 @@
|
||||
<field name="history" invisible="1"/>
|
||||
<button string="Reply"
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'reply', 'model': 'crm.lead', 'include_original' : True, 'message_id':active_id}"
|
||||
context="{'mail':'reply', 'message_id':active_id}"
|
||||
icon="terp-mail-replied" type="action"/>
|
||||
</tree>
|
||||
<form string="History">
|
||||
@@ -174,7 +174,7 @@
|
||||
<field name="description" colspan="4" nolabel="1" height="250"/>
|
||||
<button colspan="4" string="Reply"
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'reply', 'model': 'crm.lead', 'include_original' : True, 'message_id':active_id}"
|
||||
context="{'mail':'reply', 'message_id':active_id}"
|
||||
icon="terp-mail-replied" type="action"/>
|
||||
</group>
|
||||
<group attrs="{'invisible': [('history', '=', True)]}">
|
||||
@@ -193,7 +193,7 @@
|
||||
icon="terp-document-new" type="action" />
|
||||
<button string="Send New Email"
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'new', 'model': 'crm.lead', 'record_id' : active_id}"
|
||||
context="{'mail':'new'}"
|
||||
icon="terp-mail-message-new" type="action"/>
|
||||
</page>
|
||||
<page string="Extra Info" groups="base.group_extended">
|
||||
|
||||
@@ -31,9 +31,9 @@ class email_compose_message(osv.osv_memory):
|
||||
context = {}
|
||||
model = ['crm.lead', 'crm.claim', 'crm.fundraising', 'crm.helpdesk', 'event.registration', 'hr.applicant', 'project.issue']
|
||||
result = super(email_compose_message, self).default_get(cr, uid, fields, context=context)
|
||||
if context.get('record_id',False) and context.get('model',False) and context.get('model') in model:
|
||||
model_obj = self.pool.get(context.get('model'))
|
||||
data = model_obj.browse(cr, uid ,context.get('record_id'), context)
|
||||
if context.get('active_id',False) and context.get('active_model',False) and context.get('active_model') in model:
|
||||
model_obj = self.pool.get(context.get('active_model'))
|
||||
data = model_obj.browse(cr, uid ,context.get('active_id'), context)
|
||||
if 'name' in fields:
|
||||
result['name'] = data.name
|
||||
|
||||
@@ -47,13 +47,13 @@ class email_compose_message(osv.osv_memory):
|
||||
result['description'] = '\n' + (tools.ustr(data.user_id.signature or ''))
|
||||
|
||||
if 'model' in fields:
|
||||
result['model'] = context.get('model','')
|
||||
result['model'] = context.get('active_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)
|
||||
result['res_id'] = context.get('active_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
|
||||
|
||||
@@ -162,7 +162,7 @@
|
||||
<button
|
||||
string="Reply" attrs="{'invisible': [('history', '!=', True)]}"
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'reply', 'model': 'crm.claim', 'include_original' : True, 'message_id':active_id}"
|
||||
context="{'mail':'reply', 'message_id':active_id}"
|
||||
icon="terp-mail-replied" type="action" />
|
||||
</tree>
|
||||
<form string="Communication & History">
|
||||
@@ -180,7 +180,7 @@
|
||||
<field name="description" colspan="4" nolabel="1" height="250"/>
|
||||
<button colspan="4" string="Reply"
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'reply', 'model': 'crm.claim', 'include_original' : True, 'message_id':active_id}"
|
||||
context="{'mail':'reply', 'message_id':active_id}"
|
||||
icon="terp-mail-replied" type="action"/>
|
||||
</group>
|
||||
<group attrs="{'invisible': [('history', '=', True)]}">
|
||||
@@ -199,7 +199,7 @@
|
||||
icon="terp-document-new" type="action" />
|
||||
<button string="Send New Email"
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'new', 'model': 'crm.claim', 'record_id' : active_id}"
|
||||
context="{'mail':'new'}"
|
||||
icon="terp-mail-message-new" type="action"/>
|
||||
</page>
|
||||
</notebook>
|
||||
|
||||
@@ -151,7 +151,7 @@
|
||||
<button
|
||||
string="Reply" attrs="{'invisible': [('history', '!=', True)]}"
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'reply', 'model': 'crm.fundraising', 'include_original' : True, 'message_id':active_id}"
|
||||
context="{'mail':'reply', 'message_id':active_id}"
|
||||
icon="terp-mail-replied" type="action" />
|
||||
</tree>
|
||||
<form string="History">
|
||||
@@ -169,7 +169,7 @@
|
||||
<field name="description" colspan="4" nolabel="1" height="250"/>
|
||||
<button colspan="4" string="Reply"
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'reply', 'model': 'crm.fundraising', 'include_original' : True, 'message_id':active_id}"
|
||||
context="{'mail':'reply', 'message_id':active_id}"
|
||||
icon="terp-mail-replied" type="action"/>
|
||||
</group>
|
||||
<group attrs="{'invisible': [('history', '=', True)]}">
|
||||
@@ -188,7 +188,7 @@
|
||||
icon="terp-document-new" type="action" />
|
||||
<button string="Send New Email"
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'new', 'model': 'crm.fundraising', 'record_id' : active_id}"
|
||||
context="{'mail':'new'}"
|
||||
icon="terp-mail-message-new" type="action"/>
|
||||
</page>
|
||||
<page string="Extra Info" groups="base.group_extended">
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
<button
|
||||
string="Reply" attrs="{'invisible': [('history', '!=', True)]}"
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'reply', 'model': 'crm.helpdesk', 'include_original' : True, 'message_id':active_id}"
|
||||
context="{'mail':'reply', 'message_id':active_id}"
|
||||
icon="terp-mail-replied" type="action" />
|
||||
</tree>
|
||||
<form string="History">
|
||||
@@ -121,7 +121,7 @@
|
||||
<field name="description" colspan="4" nolabel="1" height="250"/>
|
||||
<button colspan="4" string="Reply"
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'reply', 'model': 'crm.helpdesk', 'include_original' : True, 'message_id':active_id}"
|
||||
context="{'mail':'reply', 'message_id':active_id}"
|
||||
icon="terp-mail-replied" type="action"/>
|
||||
</group>
|
||||
<group attrs="{'invisible': [('history', '=', True)]}">
|
||||
@@ -140,7 +140,7 @@
|
||||
icon="terp-document-new" type="action" />
|
||||
<button string="Send New Email"
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'new', 'model': 'crm.helpdesk', 'record_id' : active_id}"
|
||||
context="{'mail':'new'}"
|
||||
icon="terp-mail-message-new" type="action"/>
|
||||
</page>
|
||||
<page string="Extra Info" groups="base.group_extended">
|
||||
|
||||
@@ -394,7 +394,7 @@
|
||||
<button
|
||||
string="Reply" attrs="{'invisible': [('history', '!=', True)]}"
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'reply', 'model': 'event.registration', 'include_original' : True, 'message_id':active_id}"
|
||||
context="{'mail':'reply', 'message_id':active_id}"
|
||||
icon="terp-mail-replied" type="action" />
|
||||
</tree>
|
||||
<form string="History">
|
||||
@@ -412,7 +412,7 @@
|
||||
<field name="description" colspan="4" nolabel="1" height="250"/>
|
||||
<button colspan="4" string="Reply"
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'reply', 'model': 'event.registration', 'include_original' : True, 'message_id':active_id}"
|
||||
context="{'mail':'reply', 'message_id':active_id}"
|
||||
icon="terp-mail-replied" type="action"/>
|
||||
</group>
|
||||
<group attrs="{'invisible': [('history', '=', True)]}">
|
||||
@@ -431,7 +431,7 @@
|
||||
icon="terp-document-new" type="action" />
|
||||
<button string="Send New Email"
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'new', 'model': 'event.registration', 'record_id' : active_id}"
|
||||
context="{'mail':'new'}"
|
||||
icon="terp-mail-message-new" type="action"/>
|
||||
</page>
|
||||
</notebook>
|
||||
|
||||
@@ -148,7 +148,7 @@
|
||||
<button
|
||||
string="Reply" attrs="{'invisible': [('history', '!=', True)]}"
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'reply', 'model': 'hr.applicant', 'include_original' : True, 'message_id':active_id}"
|
||||
context="{'mail':'reply', 'message_id':active_id}"
|
||||
icon="terp-mail-replied" type="action" />
|
||||
</tree>
|
||||
<form string="History">
|
||||
@@ -166,7 +166,7 @@
|
||||
<field name="description" colspan="4" nolabel="1" height="250"/>
|
||||
<button colspan="4" string="Reply"
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'reply', 'model': 'hr.applicant', 'include_original' : True, 'message_id':active_id}"
|
||||
context="{'mail':'reply', 'message_id':active_id}"
|
||||
icon="terp-mail-replied" type="action"/>
|
||||
</group>
|
||||
<group attrs="{'invisible': [('history', '=', True)]}">
|
||||
@@ -185,7 +185,7 @@
|
||||
icon="terp-document-new" type="action" />
|
||||
<button string="Send New Email"
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'new', 'model': 'hr.applicant', 'record_id' : active_id}"
|
||||
context="{'mail':'new'}"
|
||||
icon="terp-mail-message-new" type="action"/>
|
||||
</page>
|
||||
<page string="Notes">
|
||||
|
||||
@@ -104,7 +104,7 @@
|
||||
<button
|
||||
string="Reply" attrs="{'invisible': [('history', '!=', True)]}"
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'reply', 'model': 'project.issue', 'project.issue' : True, 'message_id':active_id}"
|
||||
context="{'mail':'reply', 'message_id':active_id}"
|
||||
icon="terp-mail-replied" type="action" />
|
||||
</tree>
|
||||
<form string="History">
|
||||
@@ -122,7 +122,7 @@
|
||||
<field name="description" colspan="4" nolabel="1" height="250"/>
|
||||
<button colspan="4" string="Reply"
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'reply', 'model': 'project.issue', 'include_original' : True, 'message_id':active_id}"
|
||||
context="{'mail':'reply', 'message_id':active_id}"
|
||||
icon="terp-mail-replied" type="action"/>
|
||||
</group>
|
||||
<group attrs="{'invisible': [('history', '=', True)]}">
|
||||
@@ -142,7 +142,7 @@
|
||||
icon="terp-document-new" type="action" />
|
||||
<button string="Send New Email"
|
||||
name="%(emails.action_email_compose_message_wizard)d"
|
||||
context="{'mail':'new', 'model': 'project.issue', 'record_id' : active_id}"
|
||||
context="{'mail':'new'}"
|
||||
icon="terp-mail-message-new" type="action"/>
|
||||
</page>
|
||||
<page string="Extra Info" groups="base.group_extended">
|
||||
|
||||
@@ -396,7 +396,7 @@
|
||||
<field name="user_id"/>
|
||||
<button name="%(emails.action_email_compose_message_wizard)d"
|
||||
string="Send Email" type="action" icon="terp-mail-message-new"
|
||||
context="{'mail':'new', 'model': 'project.scrum.meeting', 'record_id' : active_id}"/>
|
||||
context="{'mail':'new'}"/>
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="Scrum Meeting">
|
||||
|
||||
@@ -31,17 +31,16 @@ class email_compose_message(osv.osv_memory):
|
||||
context = {}
|
||||
result = super(email_compose_message, self).default_get(cr, uid, fields, context=context)
|
||||
|
||||
if context.get('record_id',False) and context.get('model',False) and context.get('model') == 'project.scrum.meeting':
|
||||
if context.get('active_id',False) and context.get('active_model',False) and context.get('active_model') == 'project.scrum.meeting':
|
||||
|
||||
meeting_pool = self.pool.get('project.scrum.meeting')
|
||||
user_pool = self.pool.get('res.users')
|
||||
meeting = meeting_pool.browse(cr, uid, context.get('record_id'), context=context)
|
||||
meeting = meeting_pool.browse(cr, uid, context.get('active_id'), context=context)
|
||||
sprint = meeting.sprint_id
|
||||
|
||||
if 'email_from' in fields and sprint.scrum_master_id and sprint.scrum_master_id.user_email:
|
||||
if 'email_from' in fields:
|
||||
user_data = user_pool.browse(cr, uid, uid, context=context)
|
||||
user_email = user_data.address_id and user_data.address_id.email or False
|
||||
result.update({'email_from': user_email})
|
||||
result.update({'email_from': user_data.address_id and user_data.address_id.email or False})
|
||||
|
||||
if 'email_to' in fields and sprint.scrum_master_id and sprint.scrum_master_id.user_email:
|
||||
result.update({'email_to': sprint.scrum_master_id.user_email})
|
||||
@@ -57,6 +56,12 @@ class email_compose_message(osv.osv_memory):
|
||||
message = _("Hello , \nI am sending you Scrum Meeting : %s for the Sprint '%s' of Project '%s'") %(meeting.date, sprint.name, sprint.project_id.name)
|
||||
result.update({'description': message})
|
||||
|
||||
if 'model' in fields:
|
||||
result.update({'model':context.get('active_model')})
|
||||
|
||||
if 'res_id' in fields:
|
||||
result.update({'res_id':context.get('active_id')})
|
||||
|
||||
return result
|
||||
|
||||
email_compose_message()
|
||||
|
||||
Reference in New Issue
Block a user