From 7aaffedd2159f5d091d25cdfe7e8e75852b18733 Mon Sep 17 00:00:00 2001 From: JoshuaJan Date: Tue, 8 Sep 2015 23:31:04 +0800 Subject: [PATCH] [FIX] crm: merge opportunities for stages in 'both' type A crm.lead will either be a lead or an opportunity but a stage can also have the 'both' type so it should be matched in the domain. Closes #8434 --- addons/crm/crm_lead.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index ede6d03fe05..ebabf4a81c6 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -680,7 +680,9 @@ class crm_lead(format_address, osv.osv): # Check if the stage is in the stages of the sales team. If not, assign the stage with the lowest sequence if merged_data.get('section_id'): - section_stage_ids = self.pool.get('crm.case.stage').search(cr, uid, [('section_ids', 'in', merged_data['section_id']), ('type', '=', merged_data.get('type'))], order='sequence', context=context) + section_stage_ids = self.pool.get('crm.case.stage').search(cr, uid, [ + ('section_ids', 'in', merged_data['section_id']), ('type', 'in', [merged_data.get('type'), 'both']) + ], order='sequence', context=context) if merged_data.get('stage_id') not in section_stage_ids: merged_data['stage_id'] = section_stage_ids and section_stage_ids[0] or False # Write merged data into first opportunity