[Erp5-report] r17698 - in /erp5/trunk/bt5/erp5_accounting: WorkflowTemplateItem/portal_work...

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Nov 20 11:54:01 CET 2007


Author: jerome
Date: Tue Nov 20 11:54:01 2007
New Revision: 17698

URL: http://svn.erp5.org?rev=17698&view=rev
Log:
Don't check accounting period dates if no accounts are defined for this side

Modified:
    erp5/trunk/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/validateTransaction.xml
    erp5/trunk/bt5/erp5_accounting/bt/revision

Modified: erp5/trunk/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/validateTransaction.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/validateTransaction.xml?rev=17698&r1=17697&r2=17698&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/validateTransaction.xml (original)
+++ erp5/trunk/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/validateTransaction.xml Tue Nov 20 11:54:01 2007
@@ -104,18 +104,29 @@
 if not transaction.getStartDate() and transaction.getStopDate():\n
   transaction.setStartDate(transaction.getStopDate())\n
 \n
+      \n
+transaction_line_list = transaction.getMovementList(\n
+        portal_type=transaction.getPortalAccountingMovementTypeList())\n
 if not transaction.getStartDate() :\n
   raise ValidationFailed(N_(\'Date is not Defined\'))\n
 else:\n
   if not skip_period_validation :\n
     # check the date is in an opened period\n
     if source_section is not None:\n
+      # if we don\'t have any accounts on this side, we don\'t enforce date\n
+      # checks\n
       valid_date = False\n
+      no_accounts = True\n
+      for line in transaction_line_list:\n
+        if line.getSource():\n
+          no_accounts = False\n
+      if no_accounts:\n
+        valid_date = True\n
       transaction_date = transaction.getStartDate().earliestTime()\n
       openned_accounting_period_list = source_section.searchFolder(\n
                                  portal_type="Accounting Period",\n
                                  # planned is for b/w compatibility\n
-                                 simulation_state=("planned", \'started\'))\n
+                                 simulation_state=(\'planned\', \'started\'))\n
       if not len(source_section.contentValues(\n
                filter=dict(portal_type="Accounting Period"))):\n
         # if the entity doesn\'t have any accounting period, we can\n
@@ -131,11 +142,19 @@
                                   "for source section"))\n
     # do the same for destination section \n
     if destination_section is not None:\n
+      # if we don\'t have any accounts on this side, we don\'t enforce date\n
+      # checks\n
       valid_date = False\n
+      no_accounts = True\n
+      for line in transaction_line_list:\n
+        if line.getDestination():\n
+          no_accounts = False\n
+      if no_accounts:\n
+        valid_date = True\n
       transaction_date = transaction.getStopDate().earliestTime()\n
       openned_accounting_period_list = destination_section.searchFolder(\n
                                  portal_type = "Accounting Period",\n
-                                 simulation_state = (\'planned\', \'started\'))\n
+                                 simulation_state=(\'planned\', \'started\'))\n
       if not len(destination_section.contentValues(\n
                filter=dict(portal_type="Accounting Period"))):\n
         valid_date = True\n
@@ -223,14 +242,17 @@
                             <string>None</string>
                             <string>destination_section</string>
                             <string>currency</string>
+                            <string>transaction_line_list</string>
                             <string>False</string>
                             <string>valid_date</string>
+                            <string>True</string>
+                            <string>no_accounts</string>
+                            <string>_getiter_</string>
+                            <string>line</string>
                             <string>transaction_date</string>
                             <string>openned_accounting_period_list</string>
                             <string>len</string>
                             <string>dict</string>
-                            <string>True</string>
-                            <string>_getiter_</string>
                             <string>apd</string>
                           </tuple>
                         </value>

Modified: erp5/trunk/bt5/erp5_accounting/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/bt/revision?rev=17698&r1=17697&r2=17698&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/bt/revision (original)
+++ erp5/trunk/bt5/erp5_accounting/bt/revision Tue Nov 20 11:54:01 2007
@@ -1,1 +1,1 @@
-500
+503




More information about the Erp5-report mailing list