2011-10-17 12:44:33 +00:00
|
|
|
-
|
2012-11-14 18:41:34 +00:00
|
|
|
I merge two opportunities.
|
2011-10-17 12:44:33 +00:00
|
|
|
-
|
|
|
|
!python {model: crm.lead}: |
|
2012-11-14 18:41:34 +00:00
|
|
|
opportunity_ids = self.search(cr, uid, [('type', '=', 'opportunity'), ('state', 'not in', ['done', 'cancel']), ('partner_id', '=', ref('base.res_partner_2'))], limit=2)
|
|
|
|
assert len(opportunity_ids) == 2, 'There should be two opportunities (got %s instead)' % len(opportunity_ids)
|
2011-12-16 06:27:22 +00:00
|
|
|
context.update({'active_model': 'crm.lead', 'active_ids': opportunity_ids, 'active_id': opportunity_ids[0]})
|
2011-12-06 11:45:41 +00:00
|
|
|
-
|
|
|
|
!record {model: crm.merge.opportunity, id: opportunity_merge_id }:
|
|
|
|
-
|
|
|
|
!python {model: crm.merge.opportunity}: |
|
|
|
|
self.action_merge(cr, uid, [ref("opportunity_merge_id")], context=context)
|
|
|
|
-
|
2012-09-27 16:57:08 +00:00
|
|
|
I check for merged opportunities for customer.
|
2011-11-02 12:51:11 +00:00
|
|
|
-
|
|
|
|
!python {model: crm.lead}: |
|
2012-11-14 18:41:34 +00:00
|
|
|
merge_id = self.search(cr, uid, [('partner_id','=', ref("base.res_partner_2"))])
|
2012-11-27 16:54:01 +00:00
|
|
|
assert merge_id, 'Fail to create merge opportunity wizard'
|
|
|
|
merge_result = self.browse(cr, uid, merge_id)[0]
|
|
|
|
assert merge_result.partner_id.id == ref("base.res_partner_2"), 'Partner missmatch'
|