From a762d700df630568b7c81aae37731ce43dd00a9a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Aur=C3=A9lien=20Calonne?= <aurel@nexedi.com>
Date: Wed, 31 May 2006 14:14:39 +0000
Subject: [PATCH] fix code layout add a way to define delivery line portal type
 when creating container

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@7553 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../ERP5Banking/tests/TestERP5BankingMixin.py    | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/product/ERP5Banking/tests/TestERP5BankingMixin.py b/product/ERP5Banking/tests/TestERP5BankingMixin.py
index c473fd5535..fb27a5c974 100644
--- a/product/ERP5Banking/tests/TestERP5BankingMixin.py
+++ b/product/ERP5Banking/tests/TestERP5BankingMixin.py
@@ -378,10 +378,7 @@ class TestERP5BankingMixin:
       caveau =  c.newContent(id='caveau', portal_type='Category', codification='',  vault_type='site/caveau')
       for s in ['auxiliaire', 'reserve', 'externes', 'serre']:
         s = caveau.newContent(id='%s' %(s,), portal_type='Category', codification='',  vault_type='site/caveau/%s' %(s,))
-        if s.getId() == 'auxiliaire':
-          for ss in ['encaisse_des_billets_a_ventiler_et_a_detruire', 'encaisse_des_billets_ventiles_et_detruits']:
-            s.newContent(id='%s' %(ss,), portal_type='Category', codification='',  vault_type='site/caveau/%s' %(s.getId(),))
-        elif s.getId() == 'serre':
+        if s.getId() == 'serre':
           for ss in ['encaisse_des_billets_neufs_non_emis', 'encaisse_des_billets_retires_de_la_circulation','encaisse_des_billets_detruits']:
             ss =  s.newContent(id='%s' %(ss,), portal_type='Category', codification='',  vault_type='site/caveau/%s' %(s.getId(),))
         else:
@@ -391,6 +388,9 @@ class TestERP5BankingMixin:
               for country in ['France', 'Spain']:
                 if country[0] != c.getCodification()[0]:
                   ss.newContent(id='%s' %(country,), portal_type='Category', codification='',  vault_type='site/caveau/%s' %(s.getId(),))
+          if s.getId() == 'auxiliaire':
+            for ss in ['encaisse_des_billets_a_ventiler_et_a_detruire', 'encaisse_des_billets_ventiles_et_detruits']:
+              s.newContent(id='%s' %(ss,), portal_type='Category', codification='',  vault_type='site/caveau/%s' %(s.getId(),))
 
 
   def openCounterDate(self, date=None, site=None):
@@ -520,13 +520,13 @@ class TestERP5BankingMixin:
     return check
 
 
-  def createCashContainer(self, document, container_portal_type, global_dict, line_list,):
+  def createCashContainer(self, document, container_portal_type, global_dict, line_list, delivery_line_type='Cash Delivery Line'):
     """
     Create a cash container
     global_dict has keys :
       emission_letter, variation, cash_status, resource
     line_list is a list od dict with keys:
-      reference, range_start, range_stop, quantity
+      reference, range_start, range_stop, quantity, aggregate
     """
     # Container Creation
     base_list=('emission_letter', 'variation', 'cash_status')
@@ -540,6 +540,8 @@ class TestERP5BankingMixin:
                                                , cash_number_range_start   = line_dict['range_start']
                                                , cash_number_range_stop    = line_dict['range_stop']
                                                )
+      if line_dict.has_key('aggregate'):
+        movement_container.setAggregateValueList([line_dict['aggregate'],])
       # create a cash container line
       container_line = movement_container.newContent(portal_type      = 'Container Line'
                                                      , reindex_object = 1
@@ -564,7 +566,7 @@ class TestERP5BankingMixin:
       resource_total_quantity += line_dict['quantity']
     # create cash delivery movement
     movement_line = document.newContent(id               = "movement"
-                                        , portal_type    = 'Cash Delivery Line'
+                                        , portal_type    = delivery_line_type
                                         , resource_value = global_dict['resource']
                                         , quantity_unit_value = self.getCategoryTool().quantity_unit.unit
                                         )
-- 
2.30.9