[IMP] improve as per suggetion

bzr revid: fka@tinyerp.com-20120814065149-h1xf3we6t37bsyk3
This commit is contained in:
Foram Katharotiya (OpenERP)
2012-08-14 12:21:49 +05:30
parent 0e916d1592
commit 9fac5651d5
4 changed files with 15 additions and 30 deletions
+1 -1
View File
@@ -63,7 +63,7 @@
<!-- notify all employees of module installation -->
<function model="mail.group" name="message_append_note">
<!-- ids, subject, body, parent_id=False, type='notification', content_subtype='html' -->
<!-- ids, subject,subtype_id="other", body, parent_id=False, type='notification', content_subtype='html' -->
<value eval="[ref('mail.group_all_employees')]"/>
<value>Module CRM has been installed</value>
<value>From the top menu Sales, you can: trace leads and opportunities, get accurate forecast on your sales pipeline, plan meetings and phonecalls, get realtime statistics and efficiently organize the communication with your prospects.
+7 -21
View File
@@ -865,9 +865,7 @@ class crm_lead(base_stage, osv.osv):
def stage_set_send_note(self, cr, uid, ids, stage_id, context=None):
""" Override of the (void) default notification method. """
stage_name = self.pool.get('crm.case.stage').name_get(cr, uid, [stage_id], context=context)[0][1]
res = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'crm', 'mail_subtype_lead_stage_change')
res_id = res[1]
return self.message_append_note(cr, uid, ids, body= _("Stage changed to <b>%s</b>.") % (stage_name), subtype_id=res_id,context=context)
return self.message_append_note(cr, uid, ids, body= _("Stage changed to <b>%s</b>.") % (stage_name), subtype_id="stage change",context=context)
def case_get_note_msg_prefix(self, cr, uid, lead, context=None):
if isinstance(lead, (int, long)):
@@ -877,45 +875,33 @@ class crm_lead(base_stage, osv.osv):
def create_send_note(self, cr, uid, ids, context=None):
for id in ids:
message = _("%s has been <b>created</b>.")% (self.case_get_note_msg_prefix(cr, uid, id, context=context))
res = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'crm', 'mail_subtype_lead_new')
res_id = res[1]
self.message_append_note(cr, uid, [id], body=message, subtype_id=res_id, context=context)
self.message_append_note(cr, uid, [id], body=message, subtype_id="new", context=context)
return True
def case_mark_lost_send_note(self, cr, uid, ids, context=None):
message = _("Opportunity has been <b>lost</b>.")
res = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'crm', 'mail_subtype_lead_lost')
res_id = res[1]
return self.message_append_note(cr, uid, ids, body=message,subtype_id=res_id, context=context)
return self.message_append_note(cr, uid, ids, body=message,subtype_id="lost", context=context)
def case_mark_won_send_note(self, cr, uid, ids, context=None):
message = _("Opportunity has been <b>won</b>.")
res = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'crm', 'mail_subtype_lead_won')
res_id = res[1]
return self.message_append_note(cr, uid, ids, body=message, subtype_id=res_id, context=context)
return self.message_append_note(cr, uid, ids, body=message, subtype_id="won", context=context)
def schedule_phonecall_send_note(self, cr, uid, ids, phonecall_id, action, context=None):
phonecall = self.pool.get('crm.phonecall').browse(cr, uid, [phonecall_id], context=context)[0]
if action == 'log': prefix = 'Logged'
else: prefix = 'Scheduled'
message = _("<b>%s a call</b> for the <em>%s</em>.") % (prefix, phonecall.date)
res = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'crm', 'mail_subtype_lead_other')
res_id = res[1]
return self.message_append_note(cr, uid, ids, body=message, subtype_id=res_id, context=context)
return self.message_append_note(cr, uid, ids, body=message, context=context)
def _lead_set_partner_send_note(self, cr, uid, ids, context=None):
for lead in self.browse(cr, uid, ids, context=context):
message = _("%s <b>partner</b> is now set to <em>%s</em>." % (self.case_get_note_msg_prefix(cr, uid, lead, context=context), lead.partner_id.name))
res = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'crm', 'mail_subtype_lead_other')
res_id = res[1]
lead.message_append_note(body=message, subtype_id=res_id)
lead.message_append_note(body=message)
return True
def convert_opportunity_send_note(self, cr, uid, lead, context=None):
message = _("Lead has been <b>converted to an opportunity</b>.")
res = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'crm', 'mail_subtype_lead_other')
res_id = res[1]
lead.message_append_note(body=message, subtype_id=res_id)
lead.message_append_note(body=message)
return True
crm_lead()
+1 -1
View File
@@ -16,7 +16,7 @@
<!-- notify all employees of module installation -->
<function model="mail.group" name="message_append_note">
<!-- ids, subject, body, parent_id=False, type='notification', content_subtype='html' -->
<!-- ids, subject,subtype_id="other", body, parent_id=False, type='notification', content_subtype='html' -->
<value eval="[ref('mail.group_all_employees')]"/>
<value>Welcome to OpenERP!</value>
<value>Your homepage is a summary of messages you received and key information about documents you follow.
+6 -7
View File
@@ -228,8 +228,8 @@ class mail_thread(osv.Model):
ret_dict[model_name] = model._description
return ret_dict
def message_append(self, cr, uid, threads, subject, body_text=None, body_html=None,
type = 'email', subtype_id = False, email_date = None, parent_id = False,
def message_append(self, cr, uid, threads, subject,subtype_id = "other", body_text=None, body_html=None,
type = 'email', email_date = None, parent_id = False,
content_subtype='plain', state=None,
partner_ids=None, email_from=False, email_to=False,
email_cc=None, email_bcc=None, reply_to=None,
@@ -335,7 +335,6 @@ class mail_thread(osv.Model):
'parent_id': parent_id,
'date': email_date or fields.datetime.now(),
'type': type,
'subtype_id' : subtype_id,
'content_subtype': content_subtype,
'state': state,
'message_id': message_id,
@@ -383,11 +382,11 @@ class mail_thread(osv.Model):
"""
return self.message_append(cr, uid, ids,
subject = msg_dict.get('subject'),
subtype_id = msg_dict.get('subtype_id','other'),
body_text = msg_dict.get('body_text'),
body_html= msg_dict.get('body_html'),
parent_id = msg_dict.get('parent_id', False),
type = msg_dict.get('type', 'email'),
subtype_id = msg_dict.get('subtype_id', False),
content_subtype = msg_dict.get('content_subtype'),
state = msg_dict.get('state'),
partner_ids = msg_dict.get('partner_ids'),
@@ -867,7 +866,7 @@ class mail_thread(osv.Model):
now deprecated res.log.")
self.message_append_note(cr, uid, [id], 'res.log', message, context=context)
def message_append_note(self, cr, uid, ids, subject=None, subtype_id=False, body=None, parent_id=False,
def message_append_note(self, cr, uid, ids, subject=None, subtype_id='other', body=None, parent_id=False,
type='notification', content_subtype='html', context=None):
if content_subtype == 'html':
body_html = body
@@ -875,8 +874,8 @@ class mail_thread(osv.Model):
else:
body_html = body
body_text = body
return self.message_append(cr, uid, ids, subject, body_html, body_text,
type, subtype_id = subtype_id, parent_id = parent_id,
return self.message_append(cr, uid, ids, subject,subtype_id, body_html, body_text,
type, parent_id = parent_id,
content_subtype=content_subtype, context=context)
#------------------------------------------------------