[IMP] crm_opportunity: changed the way to mark as lost an opportunity

bzr revid: qdp-launchpad@tinyerp.com-20100712085302-eww9m9cppkdzu1h7
This commit is contained in:
qdp-launchpad@tinyerp.com
2010-07-12 14:23:02 +05:30
parent 9d317692c3
commit 7bf34551d7
2 changed files with 20 additions and 6 deletions
+14 -3
View File
@@ -70,6 +70,20 @@ class crm_opportunity(osv.osv):
self.log(cr, uid, id, message)
return res
def case_mark_lost(self, cr, uid, ids, *args):
"""Mark the case as lost: state = done and probability = 0%
@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 case Ids
@param *args: Tuple Value for additional Params
"""
res = self.write(cr, uid, ids, {'probability' : 0.0, 'state': 'done'})
for (id, name) in self.name_get(cr, uid, ids):
message = _('Opportunity ') + " '" + name + "' "+ _("is Lost.")
self.log(cr, uid, id, message)
return res
def case_cancel(self, cr, uid, ids, *args):
"""Overrides cancel for crm_case for setting probability
@param self: The object pointer
@@ -80,9 +94,6 @@ class crm_opportunity(osv.osv):
"""
res = super(crm_opportunity, self).case_cancel(cr, uid, ids, args)
self.write(cr, uid, ids, {'probability' : 0.0})
for (id, name) in self.name_get(cr, uid, ids):
message = _('Opportunity ') + " '" + name + "' "+ _("is Lost.")
self.log(cr, uid, id, message)
return res
def case_open(self, cr, uid, ids, *args):
+6 -3
View File
@@ -74,14 +74,17 @@
states="draft,open" type="object"
icon="gtk-media-pause" />
<button name="case_escalate" string="Escalate"
states="open,draft,pending" type="object"
states="open,pending" type="object"
groups="base.group_extended"
icon="gtk-go-up" />
<button name="case_cancel" string="Mark Lost"
<button name="case_cancel" string="Cancel"
states="draft,open,pending" type="object"
icon="gtk-close" />
<button name="case_mark_lost" string="Mark Lost"
states="open,pending" type="object"
icon="gtk-close" />
<button name="case_close" string="Mark Won"
states="open,draft,pending" type="object"
states="open,pending" type="object"
icon="gtk-apply" />
<button name="case_reset" string="Reset to New"
states="done,cancel" type="object"