From fecf7a584cadaa8561e4473ec2007a0446b99267 Mon Sep 17 00:00:00 2001
From: Leonardo Rochael Almeida <leonardo@nexedi.com>
Date: Thu, 7 Apr 2011 16:56:53 +0000
Subject: [PATCH] Use a business process with business links, needed by
 incoming change to Simulation Movement to fetch future trade phase by
 business link

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@45188 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../ERP5/tests/testConversionInSimulation.py   | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/product/ERP5/tests/testConversionInSimulation.py b/product/ERP5/tests/testConversionInSimulation.py
index 0e445e1892..c2a86ceef7 100644
--- a/product/ERP5/tests/testConversionInSimulation.py
+++ b/product/ERP5/tests/testConversionInSimulation.py
@@ -185,8 +185,20 @@ class TestConversionInSimulation(AccountingTestCase):
         self.portal.portal_workflow.doActionFor(account, 'validate_action')
 
   def createBusinessProcess(self, resource=None):
-    self.business_process = business_process = \
-      self.portal.business_process_module.newContent()
+    module = self.portal.business_process_module
+    name = self.__class__.__name__ + '_' + self._testMethodName
+    self.business_process = business_process = module.newContent(
+      name,
+      reference=name,
+    )
+    # copy business links from the default erp5 Business Process
+    source = module['erp5_default_business_process']
+    business_link_id_list = [obj.getId()
+                             for obj in source.objectValues()
+                             if obj.getPortalType() == 'Business Link']
+    business_process.manage_pasteObjects(
+      source.manage_copyObjects(business_link_id_list)
+    )
     trade_phase = self.getCategoryTool().trade_phase
     kw = dict(portal_type='Trade Model Path',
               trade_date='trade_phase/default/order')
@@ -254,7 +266,7 @@ class TestConversionInSimulation(AccountingTestCase):
     x_curr_ex_line.validate()
     self.createBusinessProcess(currency)
     transaction.commit()
-    self.tic()#execute transactio
+    self.tic()#execute transaction
     client = self.portal.organisation_module.newContent(
                             portal_type='Organisation',
                             title='Client',
-- 
2.30.9