From ff924e342cb3863293c0549afb489bf310088438 Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Thu, 22 Apr 2010 13:50:11 +0200 Subject: [PATCH] [FIX] crm: If an opportunity is cancelled or closed, we change the probability to 0 or 100% bzr revid: stephane@openerp.com-20100422115011-424lf40u5rj9mb5a --- addons/crm/crm.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/addons/crm/crm.py b/addons/crm/crm.py index adfbf0ca772..30e1db744cc 100644 --- a/addons/crm/crm.py +++ b/addons/crm/crm.py @@ -620,7 +620,9 @@ class crm_case(osv.osv): cases = self.browse(cr, uid, ids) cases[0].state # to fill the browse record cache self.__history(cr, uid, cases, _('Close')) - self.write(cr, uid, ids, {'state': 'done', 'date_closed': time.strftime('%Y-%m-%d %H:%M:%S')}) + self.write(cr, uid, ids, {'state': 'done', + 'date_closed': time.strftime('%Y-%m-%d %H:%M:%S'), + 'probability' : 100.0}) # # We use the cache of cases to keep the old case state # @@ -681,7 +683,9 @@ class crm_case(osv.osv): cases = self.browse(cr, uid, ids) cases[0].state # to fill the browse record cache self.__history(cr, uid, cases, _('Cancel')) - self.write(cr, uid, ids, {'state': 'cancel', 'active': True}) + self.write(cr, uid, ids, {'state': 'cancel', + 'active': True, + 'probability' : 0.0}) self._action(cr, uid, cases, 'cancel') return True @@ -764,7 +768,7 @@ class crm_case_history(osv.osv): _columns = { 'description': fields.text('Description'), 'note': fields.function(_note_get, method=True, string="Description", type="text"), - 'email_to': fields.char('Email TO', size=84), + 'email_to': fields.char('Email To', size=84), 'email_from' : fields.char('Email From', size=84), 'log_id': fields.many2one('crm.case.log','Log',ondelete='cascade'), 'message_id': fields.char('Message Id', size=1024, readonly=True, help="Message Id on Email Server.", select=True),