diff options
| author | Thibault Francois <tfr@openerp.com> | 2010-12-16 11:54:45 +0100 |
|---|---|---|
| committer | Thibault Francois <tfr@openerp.com> | 2010-12-16 11:54:45 +0100 |
| commit | cf13a034f3fe74dbfb01445b84dedc8d9537c58e (patch) | |
| tree | 2b1d0dc652f58019a720876e5cf27abf69492d71 | |
| parent | d5ef9b0b3c55e7a2e7a940b0a9f42e81f2f0d6da (diff) | |
[FIX] crm : next and previous fix behavior
bzr revid: tfr@openerp.com-20101216105445-cqx8duv6hmto43mn
| -rw-r--r-- | addons/crm/crm.py | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/addons/crm/crm.py b/addons/crm/crm.py index 233bfcc4b5a..c06280e3427 100644 --- a/addons/crm/crm.py +++ b/addons/crm/crm.py @@ -216,17 +216,21 @@ class crm_case(object): def stage_change(self, cr, uid, ids, context=None, order='sequence'): if not context: context = {} + stage_pool = self.pool.get('crm.case.stage') stage_type = context and context.get('stage_type','') + current_seq = False next_stage_id = False + for case in self.browse(cr, uid, ids, context): next_stage = False - data = {} + value = {} + if case.section_id.id : + domain = [('type', '=', stage_type),('section_ids', '=', case.section_id.id)] + else : + domain = [('type', '=', stage_type)] - domain = [('type', '=', stage_type),('section_ids', '=', case.section_id.id)] - if case.section_id and case.section_id.stage_ids: - domain.append(('id', 'in', map(lambda x: x.id, case.section_id.stage_ids))) stages = stage_pool.search(cr, uid, domain, order=order) current_seq = case.stage_id.sequence @@ -238,13 +242,13 @@ class crm_case(object): if next_stage: next_stage_id = next_stage.id - data = {'stage_id': next_stage.id} + value.update({'stage_id': next_stage.id}) if next_stage.on_change: - data.update({'probability': next_stage.probability}) - self.write(cr, uid, [case.id], data, context=context) + value.update({'probability': next_stage.probability}) + self.write(cr, uid, [case.id], value, context=context) - return next_stage_id + return next_stage_id #FIXME should return a list of all id def stage_next(self, cr, uid, ids, context=None): |
