From 6e93201b13e80c45c55e67b821f4288155ae8be8 Mon Sep 17 00:00:00 2001 From: "rpa (Open ERP)" Date: Thu, 22 Jul 2010 16:30:56 +0530 Subject: [PATCH] [IMP]: crm, crm_claim, crm_fundraising, crm_helpdesk: Improvement for log messages bzr revid: rpa@tinyerp.com-20100722110056-udb2qy6gtwbr5whe --- addons/crm/crm.py | 7 +++++++ addons/crm/crm_lead.py | 6 +++--- addons/crm/crm_meeting.py | 16 +++++++++++++++- addons/crm/crm_opportunity.py | 10 +++++----- addons/crm_claim/crm_claim.py | 2 +- addons/crm_fundraising/crm_fundraising.py | 2 +- addons/crm_helpdesk/crm_helpdesk.py | 2 +- 7 files changed, 33 insertions(+), 12 deletions(-) diff --git a/addons/crm/crm.py b/addons/crm/crm.py index 4b1aad7cce9..478cd7b2986 100644 --- a/addons/crm/crm.py +++ b/addons/crm/crm.py @@ -301,6 +301,13 @@ class crm_case(object): self.write(cr, uid, ids, {'state': 'cancel', 'active': True}) self._action(cr, uid, cases, 'cancel') + for case in cases: + message = "The " + self._description + " '" + case.name + "' has been Cancelled." + #TODO: Need to differentiate lead and opportunity +# if hasattr(case, 'type'): +# #TO CHECK: hasattr gives warning for other crm objects that don't have field 'type' +# message = "The " + (case.type or 'Case').title() + " '" + case.name + "' has been Cancelled." + self.log(cr, uid, case.id, message) return True def case_pending(self, cr, uid, ids, *args): diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index 2a469d88baa..9cb5f31d67e 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -198,8 +198,8 @@ class crm_lead(osv.osv, crm_case): self.write(cr, uid, ids, value) for (id, name) in self.name_get(cr, uid, ids): - type = self.browse(cr, uid, id).type - message = (_('The ') + type.title() or 'Lead') + " '" + name + "' "+ _("has been written as Open.") + type = self.browse(cr, uid, id).type or 'Lead' + message = (_('The ') + type.title()) + " '" + name + "' "+ _("has been Opened.") self.log(cr, uid, id, message) return res @@ -216,7 +216,7 @@ class crm_lead(osv.osv, crm_case): for (id, name) in self.name_get(cr, uid, ids): lead = self.browse(cr, uid, id) if lead.type == 'lead': - message = _('The Lead') + " '" + name + "' "+ _("has been written as Closed.") + message = _('The Lead') + " '" + name + "' "+ _("has been Closed.") self.log(cr, uid, id, message) return res diff --git a/addons/crm/crm_meeting.py b/addons/crm/crm_meeting.py index 79a2c992cdf..798f746f9e3 100644 --- a/addons/crm/crm_meeting.py +++ b/addons/crm/crm_meeting.py @@ -122,7 +122,21 @@ class crm_meeting(osv.osv, crm_case): } return value - + + def case_open(self, cr, uid, ids, *args): + """Confirms meeting + @param self: The object pointer + @param cr: the current row, from the database cursor, + @param uid: the current user’s ID for security checks, + @param ids: List of Meeting Ids + @param *args: Tuple Value for additional Params + """ + res = super(crm_meeting, self).case_open(cr, uid, ids, args) + for (id, name) in self.name_get(cr, uid, ids): + message = _('The Meeting') + " '" + name + "' "+ _("has been Confirmed.") + self.log(cr, uid, id, message) + return res + crm_meeting() class calendar_attendee(osv.osv): diff --git a/addons/crm/crm_opportunity.py b/addons/crm/crm_opportunity.py index a1ca912e20f..c058732a3dd 100644 --- a/addons/crm/crm_opportunity.py +++ b/addons/crm/crm_opportunity.py @@ -36,8 +36,6 @@ AVAILABLE_STATES = [ class crm_opportunity(osv.osv): """ Opportunity Cases """ - _name = "crm.lead" - _description = "Opportunity" _order = "priority,date_action,id desc" _inherit = 'crm.lead' _columns = { @@ -72,8 +70,10 @@ class crm_opportunity(osv.osv): self.write(cr, uid, ids, value) for (id, name) in self.name_get(cr, uid, ids): - message = _('The Opportunity') + " '" + name + "' "+ _("has been written as Won.") - self.log(cr, uid, id, message) + opp = self.browse(cr, uid, id) + if opp.type == 'opportunity': + message = _('The Opportunity') + " '" + name + "' "+ _("has been Won.") + self.log(cr, uid, id, message) return res def case_mark_lost(self, cr, uid, ids, *args): @@ -95,7 +95,7 @@ class crm_opportunity(osv.osv): for (id, name) in self.name_get(cr, uid, ids): opp = self.browse(cr, uid, id) if opp.type == 'opportunity': - message = _('The Opportunity') + " '" + name + "' "+ _("has been written as Lost.") + message = _('The Opportunity') + " '" + name + "' "+ _("has been Lost.") self.log(cr, uid, id, message) return res diff --git a/addons/crm_claim/crm_claim.py b/addons/crm_claim/crm_claim.py index b453ebfc4aa..76a6073b58c 100644 --- a/addons/crm_claim/crm_claim.py +++ b/addons/crm_claim/crm_claim.py @@ -28,7 +28,7 @@ class crm_claim(osv.osv, crm.crm_case): Crm claim """ _name = "crm.claim" - _description = "Claim Cases" + _description = "Claim" _order = "id desc" _inherit = ['mailgate.thread'] _columns = { diff --git a/addons/crm_fundraising/crm_fundraising.py b/addons/crm_fundraising/crm_fundraising.py index 99b8fc06dae..81e16a47ac3 100644 --- a/addons/crm_fundraising/crm_fundraising.py +++ b/addons/crm_fundraising/crm_fundraising.py @@ -26,7 +26,7 @@ class crm_fundraising(osv.osv, crm.crm_case): """ Fund Raising Cases """ _name = "crm.fundraising" - _description = "Fund Raising Cases" + _description = "Fund Raising" _order = "id desc" _inherit = ['mailgate.thread'] _columns = { diff --git a/addons/crm_helpdesk/crm_helpdesk.py b/addons/crm_helpdesk/crm_helpdesk.py index 2894a429865..d4a1e9d59fc 100644 --- a/addons/crm_helpdesk/crm_helpdesk.py +++ b/addons/crm_helpdesk/crm_helpdesk.py @@ -27,7 +27,7 @@ class crm_helpdesk(osv.osv, crm.crm_case): """ Helpdesk Cases """ _name = "crm.helpdesk" - _description = "Helpdesk Cases" + _description = "Helpdesk" _order = "id desc" _inherit = ['mailgate.thread'] _columns = {