- 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]
- return self.message_post(cr, uid, ids, body=_("Stage changed to <b>%s</b>.") % (stage_name), subtype="mt_crm_stage", context=context)
-
- def case_get_note_msg_prefix(self, cr, uid, lead, context=None):
- if isinstance(lead, (int, long)):
- lead = self.browse(cr, uid, [lead], context=context)[0]
- return ('Opportunity' if lead.type == 'opportunity' else 'Lead')
-
- 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))
- self.message_post(cr, uid, [id], body=message, context=context)
- return True
-
- def case_mark_lost_send_note(self, cr, uid, ids, context=None):
- message = _("Opportunity has been <b>lost</b>.")
- return self.message_post(cr, uid, ids, body=message, subtype="mt_crm_lost", context=context)
-
- def case_mark_won_send_note(self, cr, uid, ids, context=None):
- message = _("Opportunity has been <b>won</b>.")
- return self.message_post(cr, uid, ids, body=message, subtype="mt_crm_won", context=context)
-