[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
This commit is contained in:
Antonin Bourguignon
2012-11-30 19:59:17 +01:00
parent 94197bdf2a
commit 448888985b
@@ -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'
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