From 448888985b708aead570da74f854e434ced8b9b3 Mon Sep 17 00:00:00 2001 From: Antonin Bourguignon Date: Fri, 30 Nov 2012 19:59:17 +0100 Subject: [PATCH] [IMP] tests for the salesmen assignations; properly use m2m operations instead of a simple list of ids (which doesn't work - and it should be corrected in several other tests) bzr revid: abo@openerp.com-20121130185917-3jxajrp7c3usp5hv --- .../crm/test/process/lead2opportunity_assign_salesmen.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/crm/test/process/lead2opportunity_assign_salesmen.yml b/addons/crm/test/process/lead2opportunity_assign_salesmen.yml index 31ea6fde4db..1cd6e41a3df 100644 --- a/addons/crm/test/process/lead2opportunity_assign_salesmen.yml +++ b/addons/crm/test/process/lead2opportunity_assign_salesmen.yml @@ -55,7 +55,7 @@ - !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")}) - id = self.create(cr, uid, {'user_ids': [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')}, context=context) + 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')}, 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. @@ -65,4 +65,6 @@ salesmen_ids = [ref('test_res_user_01'), ref('test_res_user_02'), ref('test_res_user_03'), ref('test_res_user_04')] i = 0 for opp in opps: - assert opp.type == 'opportunity', 'Type mismatch: this should be an opp, not a lead' \ No newline at end of file + assert opp.type == 'opportunity', 'Type mismatch: this should be an opp, not a lead' + assert opp.user_id == salesmen_ids[i], 'Salesman mismatch: expected salesman %s, got %s' % (salesmen_ids[i], opp.user_id.id) + i = i+1 if (i < len(salesmen_ids) - 1) else 0 \ No newline at end of file