From abf8e0d54f63dcc8cbf7a8fc3b8745fa138b1ad3 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Thu, 20 Mar 2014 18:51:29 +0100 Subject: [PATCH 1/2] [ADD] crm: mass convert lead to opp, add force assignation checkbox, to force the salesman/salesteam on converted/merged lead/opps or leave the existing salesman/salesteam bzr revid: dle@openerp.com-20140320175129-2lj2pu86l3rjoulw --- addons/crm/wizard/crm_lead_to_opportunity.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/addons/crm/wizard/crm_lead_to_opportunity.py b/addons/crm/wizard/crm_lead_to_opportunity.py index 347475d100f..70f6712df74 100644 --- a/addons/crm/wizard/crm_lead_to_opportunity.py +++ b/addons/crm/wizard/crm_lead_to_opportunity.py @@ -197,8 +197,7 @@ class crm_lead2opportunity_mass_convert(osv.osv_memory): ('each_exist_or_create', 'Use existing partner or create'), ('nothing', 'Do not link to a customer') ], 'Related Customer', required=True), - # Uncomment me in trunk - # 'force_assignation': fields.boolean('Force assignation', help='If unchecked, this will leave the salesman of duplicated opportunities'), + 'force_assignation': fields.boolean('Force assignation', help='If unchecked, this will leave the salesman of duplicated opportunities'), } _defaults = { @@ -274,10 +273,7 @@ class crm_lead2opportunity_mass_convert(osv.osv_memory): active_ids = active_ids.difference(merged_lead_ids) active_ids = active_ids.union(remaining_lead_ids) ctx['active_ids'] = list(active_ids) - # Remove me in trunk - ctx['no_force_assignation'] = ctx.get('no_force_assignation', True) - # Uncomment me in trunk - # ctx['no_force_assignation'] = not data.force_assignation + ctx['no_force_assignation'] = not data.force_assignation return self.action_apply(cr, uid, ids, context=ctx) # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: From 54d8cd1e866d1a6dc0b594588a6d900d6404728c Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Thu, 20 Mar 2014 19:38:14 +0100 Subject: [PATCH 2/2] [FIX] crm: round robin tests on salesman assignation set force assignation true bzr revid: dle@openerp.com-20140320183814-163zwgilty4l2jv7 --- addons/crm/test/lead2opportunity_assign_salesmen.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/crm/test/lead2opportunity_assign_salesmen.yml b/addons/crm/test/lead2opportunity_assign_salesmen.yml index 12d212ec5fd..76b35be531d 100644 --- a/addons/crm/test/lead2opportunity_assign_salesmen.yml +++ b/addons/crm/test/lead2opportunity_assign_salesmen.yml @@ -65,8 +65,8 @@ Salesman create a mass convert wizard and convert all the leads. - !python {model: crm.lead2opportunity.partner.mass}: | - context.update({'active_model': 'crm.lead', 'active_ids': [ref("test_crm_lead_01"), ref("test_crm_lead_02"), ref("test_crm_lead_03"), ref("test_crm_lead_04"), ref("test_crm_lead_05"), ref("test_crm_lead_06")], 'active_id': ref("test_crm_lead_01"), 'no_force_assignation': False}) - id = self.create(cr, uid, {'user_ids': [(6, 0, [ref('test_res_user_01'), ref('test_res_user_02'), ref('test_res_user_03'), ref('test_res_user_04')])], 'section_id': ref('crm.section_sales_department'), 'deduplicate': False}, context=context) + context.update({'active_model': 'crm.lead', 'active_ids': [ref("test_crm_lead_01"), ref("test_crm_lead_02"), ref("test_crm_lead_03"), ref("test_crm_lead_04"), ref("test_crm_lead_05"), ref("test_crm_lead_06")], 'active_id': ref("test_crm_lead_01")}) + id = self.create(cr, uid, {'user_ids': [(6, 0, [ref('test_res_user_01'), ref('test_res_user_02'), ref('test_res_user_03'), ref('test_res_user_04')])], 'section_id': ref('crm.section_sales_department'), 'deduplicate': False, 'force_assignation': True}, context=context) self.mass_convert(cr, uid, [id], context=context) - The leads should now be opps with a salesman and a salesteam. Also, salesmen should have been assigned following a round-robin method.