[Erp5-report] r14952 - /erp5/trunk/products/ERP5Banking/tests/TestERP5BankingMixin.py

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Jun 25 16:20:26 CEST 2007


Author: vincent
Date: Mon Jun 25 16:20:25 2007
New Revision: 14952

URL: http://svn.erp5.org?rev=14952&view=rev
Log:
Add openAccountingDate method and factorise common code with openCounterDate.

Modified:
    erp5/trunk/products/ERP5Banking/tests/TestERP5BankingMixin.py

Modified: erp5/trunk/products/ERP5Banking/tests/TestERP5BankingMixin.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Banking/tests/TestERP5BankingMixin.py?rev=14952&r1=14951&r2=14952&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Banking/tests/TestERP5BankingMixin.py (original)
+++ erp5/trunk/products/ERP5Banking/tests/TestERP5BankingMixin.py Mon Jun 25 16:20:25 2007
@@ -644,27 +644,30 @@
       if 'siege' not in site_list:
         self.siege = self.testsite.newContent(id='siege', portal_type='Category', codification='HQ1',  vault_type='site')
 
-
-  def openCounterDate(self, date=None, site=None,id='counter_date_1',open=1):
-    """
-    open a couter date fort the given date
-    by default use the current date
-    """
+  def _openDate(self, date=None, site=None, id=None, open=True, container=None, portal_type=None):
     if date is None:
       date = DateTime().Date()
     if site is None:
       site = self.testsite
-    # create a counter date
-    counter_date_module = self.getCounterDateModule()
-
-    counter_date = counter_date_module.newContent(id=id, portal_type="Counter Date",
-                                                            site_value = site,
-                                                            start_date = date)
-    # open the counter date
+    date_object = container.newContent(id=id, portal_type=portal_type,
+                                       site_value = site, start_date = date)
     if open:
-      counter_date.open()
-    setattr(self,id,counter_date)
-
+      date_object.open()
+    setattr(self, id, date_object)
+
+  def openAccountingDate(self, date=None, site=None, id='accounting_date_1', open=True):
+    """
+    open an accounting date for the given date
+    by default use the current date
+    """
+    self._openDate(date=date, site=site, id=id, open=open, container=self.getAccountingDateModule(), portal_type='Accounting Date')
+
+  def openCounterDate(self, date=None, site=None, id='counter_date_1', open=True):
+    """
+    open a couter date for the given date
+    by default use the current date
+    """
+    self._openDate(date=date, site=site, id=id, open=open, container=self.getCounterDateModule(), portal_type='Counter Date')
 
   def openCounter(self, site=None, id='counter_1'):
     """




More information about the Erp5-report mailing list