[FIX] crm: If an opportunity is cancelled or closed, we change the probability to 0 or 100%

bzr revid: stephane@openerp.com-20100422115011-424lf40u5rj9mb5a
This commit is contained in:
Stephane Wirtel
2010-04-22 13:50:11 +02:00
parent 730f332a80
commit ff924e342c
+7 -3
View File
@@ -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),