From 78e3af7ace703ce0a30b04e8f7f768cecaab980e Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Wed, 28 Jul 2010 19:13:10 +0200 Subject: [PATCH 1/5] [IMP] crm: allow selection of crm.case.stage items that have no sales team assigned even when a sales team is selected bzr revid: odo@openerp.com-20100728171310-mwxvxya3k4pnslbc --- addons/crm/crm.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/addons/crm/crm.py b/addons/crm/crm.py index 2cabefd7f13..47a3938e1e2 100644 --- a/addons/crm/crm.py +++ b/addons/crm/crm.py @@ -121,7 +121,6 @@ class crm_case(object): s = self.get_stage_dict(cr, uid, ids, context=context) section = self._name stage = False - stage_pool = self.pool.get('crm.case.stage') for case in self.browse(cr, uid, ids, context): if section in s: st = not context.get('force_domain', False) and case.stage_id.id or False @@ -141,8 +140,18 @@ class crm_case(object): if not context: context = {} stage_obj = self.pool.get('crm.case.stage') - tmp = self.read(cr, uid, ids, ['section_id'], context)[0]['section_id'] - section_id = tmp and tmp[0] or False + res = self.read(cr, uid, ids, ['section_id', 'stage_id'], context)[0] + section_id = res['section_id'] and res['section_id'][0] or False + stage_id = res['stage_id'] and res['stage_id'][0] or False + + # We select either the stages in the same section as the current stage + # if it a stage that does not have a section, or the stages of the + # current section of the case + if stage_id: + stage_record = stage_obj.browse(cr, uid, stage_id) + if not stage_record.section_id: + section_id = False # only select stages without section + domain = [('object_id.model', '=', self._name), ('section_id', '=', section_id)] if 'force_domain' in context and context['force_domain']: domain += context['force_domain'] @@ -150,6 +159,7 @@ class crm_case(object): s = {} previous = {} section = self._name + for stage in stage_obj.browse(cr, uid, sid, context=context): s.setdefault(section, {}) s[section][previous.get(section, False)] = stage.id From fba2b058c66c008c1e64ff33a917e8c82cbe5524 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Wed, 28 Jul 2010 19:20:37 +0200 Subject: [PATCH 2/5] [IMP] crm: include additional lead details when forwarding an opportunity that is not linked to a partner + typos and cleanup bzr revid: odo@openerp.com-20100728172037-7lxqta80loiwulh2 --- addons/crm/crm_lead.py | 7 +--- addons/crm/crm_opportunity_view.xml | 2 +- addons/crm/wizard/crm_forward_to_partner.py | 42 ++++++++++----------- 3 files changed, 24 insertions(+), 27 deletions(-) diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index dd18d055f64..4ae7b1dd344 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -19,15 +19,13 @@ # ############################################################################## -from osv import fields, osv, orm -from datetime import datetime, timedelta +from osv import fields, osv +from datetime import datetime import crm -import math import time import mx.DateTime from tools.translate import _ from crm import crm_case -import collections import binascii import tools @@ -348,7 +346,6 @@ class crm_lead(osv.osv, crm_case): if isinstance(ids, (str, int, long)): ids = [ids] - msg_from = msg['from'] if msg.get('priority'): vals['priority'] = msg.get('priority') diff --git a/addons/crm/crm_opportunity_view.xml b/addons/crm/crm_opportunity_view.xml index 3a2e58efdb0..3ccfb1b1e18 100644 --- a/addons/crm/crm_opportunity_view.xml +++ b/addons/crm/crm_opportunity_view.xml @@ -156,7 +156,7 @@ name="%(crm.action_crm_send_mail)d" context="{'mail':'new', 'model': 'crm.lead'}" icon="terp-mail-message-new" type="action" /> -