[Erp5-report] r14532 - in /erp5/trunk/bt5/erp5_banking_check: SkinTemplateItem/portal_skins...

nobody at svn.erp5.org nobody at svn.erp5.org
Mon May 21 18:02:02 CEST 2007


Author: vincent
Date: Mon May 21 18:02:02 2007
New Revision: 14532

URL: http://svn.erp5.org?rev=14532&view=rev
Log:
Make Base_checkOrCreateCheck take a back_account parameter used to override bank account automatic recovery.
Factorize and cleanup check_deposit_workflow and check_payment_workflow validateConsistency script parts related to check validation.

Added:
    erp5/trunk/bt5/erp5_banking_check/SkinTemplateItem/portal_skins/erp5_banking_check_operation/Base_checkCheck.xml
Modified:
    erp5/trunk/bt5/erp5_banking_check/SkinTemplateItem/portal_skins/erp5_banking_check_operation/Base_checkOrCreateCheck.xml
    erp5/trunk/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_deposit_workflow/scripts/validateConsistency.xml
    erp5/trunk/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/scripts/validateConsistency.xml
    erp5/trunk/bt5/erp5_banking_check/bt/revision

Added: erp5/trunk/bt5/erp5_banking_check/SkinTemplateItem/portal_skins/erp5_banking_check_operation/Base_checkCheck.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_banking_check/SkinTemplateItem/portal_skins/erp5_banking_check_operation/Base_checkCheck.xml?rev=14532&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_banking_check/SkinTemplateItem/portal_skins/erp5_banking_check_operation/Base_checkCheck.xml (added)
+++ erp5/trunk/bt5/erp5_banking_check/SkinTemplateItem/portal_skins/erp5_banking_check_operation/Base_checkCheck.xml Mon May 21 18:02:02 2007
@@ -1,0 +1,188 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
+        <tuple/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>Python_magic</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>Script_magic</string> </key>
+            <value> <int>3</int> </value>
+        </item>
+        <item>
+            <key> <string>__ac_local_roles__</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_bind_names</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
+                </klass>
+                <tuple/>
+                <state>
+                  <dictionary>
+                    <item>
+                        <key> <string>_asgns</string> </key>
+                        <value>
+                          <dictionary>
+                            <item>
+                                <key> <string>name_container</string> </key>
+                                <value> <string>container</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_context</string> </key>
+                                <value> <string>context</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_m_self</string> </key>
+                                <value> <string>script</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_subpath</string> </key>
+                                <value> <string>traverse_subpath</string> </value>
+                            </item>
+                          </dictionary>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>_body</string> </key>
+            <value> <string encoding="cdata"><![CDATA[
+
+# Check that a check exists for given bank account and reference.\n
+result = context.Base_checkOrCreateCheck(reference=reference, bank_account=bank_account)\n
+resul_len = len(result)\n
+if result_len == 0:\n
+  msg = Message(domain=\'ui\', message="No such check")\n
+  raise ValidationFailed, (msg,)\n
+elif result_len > 1:\n
+  msg = Message(domain=\'ui\', message=\'Duplicate checks for the same check number\')\n
+  raise ValidationFailed, (msg,)\n
+\n
+check = result[0].getObject()\n
+\n
+bad_simulation_state_dict = {\'draft\': \'The check is not issued yet.\',\n
+                             \'cancelled\': \'The check has been stopped.\',\n
+                             \'delivered\': \'The check has already been cashed.\',\n
+                             \'stopped\': \'The check is stopped.\'}\n
+\n
+simulation_state = check.getSimulationState()\n
+if simulation_state != \'confirmed\':\n
+  if simulation_state in bad_simulation_state_dict:\n
+    msg = Message(domain=\'ui\', message=bad_simulation_state_dict[simulation_state])\n
+  else:\n
+    msg = \'Invalid and unhandled simulation state: %s\' % (simulation_state, )\n
+  raise ValidationFailed, (msg,)\n
+\n
+return check\n
+
+
+]]></string> </value>
+        </item>
+        <item>
+            <key> <string>_code</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_filepath</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_owner</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_params</string> </key>
+            <value> <string>bank_account, reference</string> </value>
+        </item>
+        <item>
+            <key> <string>errors</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_code</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
+                </klass>
+                <tuple/>
+                <state>
+                  <dictionary>
+                    <item>
+                        <key> <string>co_argcount</string> </key>
+                        <value> <int>2</int> </value>
+                    </item>
+                    <item>
+                        <key> <string>co_varnames</string> </key>
+                        <value>
+                          <tuple>
+                            <string>bank_account</string>
+                            <string>reference</string>
+                            <string>_getattr_</string>
+<string>context</string>
+                            <string>result</string>
+                            <string>len</string>
+                            <string>resul_len</string>
+                            <string>result_len</string>
+                            <string>Message</string>
+                            <string>msg</string>
+                            <string>ValidationFailed</string>
+                            <string>_getitem_</string>
+                            <string>check</string>
+                            <string>bad_simulation_state_dict</string>
+                            <string>simulation_state</string>
+                          </tuple>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_defaults</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>Base_checkCheck</string> </value>
+        </item>
+        <item>
+            <key> <string>warnings</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>

Modified: erp5/trunk/bt5/erp5_banking_check/SkinTemplateItem/portal_skins/erp5_banking_check_operation/Base_checkOrCreateCheck.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_banking_check/SkinTemplateItem/portal_skins/erp5_banking_check_operation/Base_checkOrCreateCheck.xml?rev=14532&r1=14531&r2=14532&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_banking_check/SkinTemplateItem/portal_skins/erp5_banking_check_operation/Base_checkOrCreateCheck.xml (original)
+++ erp5/trunk/bt5/erp5_banking_check/SkinTemplateItem/portal_skins/erp5_banking_check_operation/Base_checkOrCreateCheck.xml Mon May 21 18:02:02 2007
@@ -74,12 +74,11 @@
 from Products.ERP5Type.Message import Message\n
 from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
 \n
-if destination:\n
-  bank_account = context.getDestinationPaymentValue()\n
-elif source:\n
-  bank_account = context.getSourcePaymentValue()\n
-else:\n
-  bank_account = None\n
+if bank_account is None:\n
+  if destination:\n
+    bank_account = context.getDestinationPaymentValue()\n
+  elif source:\n
+    bank_account = context.getSourcePaymentValue()\n
   \n
 if bank_account is None:\n
   msg = Message(domain=\'ui\',message=\'Sorry, you must select an account\')\n
@@ -119,7 +118,7 @@
   if context.portal_activities.countMessageWithTag(message_tag) != 0:\n
     msg = Message(domain=\'ui\', message="This check number is already being indexed.")\n
     raise ValidationFailed, (msg,)\n
-  result = context.portal_catalog(portal_type = \'Check\', reference = check_reference)\n
+  result = context.portal_catalog(portal_type = \'Check\', reference = check_reference, destination_payment_uid = bank_account.getUid())\n
   if len(result) == 0:\n
     if not context.Base_isAutomaticCheckCreationAllowed():\n
       msg = Message(domain = "ui", message="Sorry, this reference does not exist")\n
@@ -180,7 +179,7 @@
         </item>
         <item>
             <key> <string>_params</string> </key>
-            <value> <string>reference=None, reference_range_min=None, reference_range_max=None, source=0, destination=1</string> </value>
+            <value> <string>reference=None, reference_range_min=None, reference_range_max=None, source=0, destination=1, bank_account=None</string> </value>
         </item>
         <item>
             <key> <string>errors</string> </key>
@@ -200,7 +199,7 @@
                   <dictionary>
                     <item>
                         <key> <string>co_argcount</string> </key>
-                        <value> <int>5</int> </value>
+                        <value> <int>6</int> </value>
                     </item>
                     <item>
                         <key> <string>co_varnames</string> </key>
@@ -211,14 +210,14 @@
                             <string>reference_range_max</string>
                             <string>source</string>
                             <string>destination</string>
+                            <string>bank_account</string>
                             <string>Products.ERP5Type.Message</string>
                             <string>Message</string>
                             <string>Products.DCWorkflow.DCWorkflow</string>
                             <string>ValidationFailed</string>
+                            <string>None</string>
                             <string>_getattr_</string>
                             <string>context</string>
-                            <string>bank_account</string>
-                            <string>None</string>
                             <string>msg</string>
                             <string>reference_list</string>
                             <string>int</string>
@@ -254,6 +253,7 @@
                 <none/>
                 <int>0</int>
                 <int>1</int>
+                <none/>
               </tuple>
             </value>
         </item>

Modified: erp5/trunk/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_deposit_workflow/scripts/validateConsistency.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_deposit_workflow/scripts/validateConsistency.xml?rev=14532&r1=14531&r2=14532&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_deposit_workflow/scripts/validateConsistency.xml (original)
+++ erp5/trunk/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_deposit_workflow/scripts/validateConsistency.xml Mon May 21 18:02:02 2007
@@ -116,36 +116,7 @@
     msg = Message(domain=\'ui\', message="Unknown error code.")\n
     raise ValidationFailed, (msg,)\n
 \n
-  result = context.portal_catalog(portal_type = \'Check\', reference = check_number)\n
-  if len(result) == 0:\n
-    # Until a certain date, ERP5 allows the user to generate a check automatically.\n
-    from DateTime import DateTime\n
-    now = DateTime()\n
-    stop_date = context.Baobab_getAutomaticCheckCreationStopDate()\n
-    if now > stop_date:\n
-      msg = Message(domain=\'ui\', message=\'No such check.\')\n
-      raise ValidationFailed, (msg,)\n
-  elif len(result) == 1:\n
-    # Check if this check has the same bank account as the payment.\n
-    check = result[0].getObject()\n
-    if check_operation_line.getSourcePaymentReference() != check.getDestinationPaymentReference():\n
-      msg = Message(domain=\'ui\', message=\'Bank account do not match between payment and check.\')\n
-      raise ValidationFailed, (msg,)\n
-    # Check the state of this check.\n
-    state = check.getSimulationState()\n
-    if state != \'confirmed\':\n
-      if state == \'draft\':\n
-        msg = Message(domain=\'ui\', message=\'The check is not issued yet.\')\n
-      elif state == \'cancelled\':\n
-        msg = Message(domain=\'ui\', message=\'The check has been canceled.\')\n
-      elif state == \'delivered\':\n
-        msg = Message(domain=\'ui\', message=\'The check has already been cashed.\')\n
-      elif state == \'stopped\':\n
-        msg = Message(domain=\'ui\', message=\'The check has been stopped.\')\n
-      raise ValidationFailed, (msg,)\n
-  else:\n
-    msg = Message(domain=\'ui\', message="Duplicated checks for the same check number.")\n
-    raise ValidationFailed, (msg,)\n
+  transaction.Base_checkCheck(bank_account=source_bank_account, reference=check_number)\n
 \n
 if transaction.getSimulationState() == "draft":\n
   context.updateBankingOperation(state_change)\n
@@ -225,13 +196,6 @@
                             <string>source_bank_account</string>
                             <string>context</string>
                             <string>error</string>
-                            <string>result</string>
-                            <string>len</string>
-                            <string>DateTime</string>
-                            <string>now</string>
-                            <string>stop_date</string>
-                            <string>check</string>
-                            <string>state</string>
                           </tuple>
                         </value>
                     </item>

Modified: erp5/trunk/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/scripts/validateConsistency.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/scripts/validateConsistency.xml?rev=14532&r1=14531&r2=14532&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/scripts/validateConsistency.xml (original)
+++ erp5/trunk/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/scripts/validateConsistency.xml Mon May 21 18:02:02 2007
@@ -124,37 +124,7 @@
 if not check_number:\n
   msg = Message(domain=\'ui\', message="Check not defined.")\n
   raise ValidationFailed, (msg,)\n
-\n
-result = context.portal_catalog(portal_type = \'Check\', title = check_number,simulation_state=\'confirmed\')\n
-if len(result) == 0:\n
-  # Until a certain date, ERP5 allows the user to generate a check automatically.\n
-  from DateTime import DateTime\n
-  now = DateTime()\n
-  stop_date = context.Baobab_getAutomaticCheckCreationStopDate()\n
-  if now > stop_date:\n
-    msg = Message(domain=\'ui\', message="No such check")\n
-    raise ValidationFailed, (msg,)\n
-elif len(result) == 1:\n
-  # Check if this check has the same bank account as the payment.\n
-  check = result[0].getObject()\n
-  if transaction.getDestinationPaymentReference() != check.getDestinationPaymentReference():\n
-    msg = Message(domain=\'ui\', message="Bank account do not match between payment and check.")\n
-    raise ValidationFailed, (msg,)\n
-  # Check the state of this check.\n
-  state = check.getSimulationState()\n
-  if state != \'confirmed\':\n
-    if state == \'draft\':\n
-      msg = Message(domain=\'ui\', message=\'The check is not issued yet.\')\n
-    elif state == \'cancelled\':\n
-      msg = Message(domain=\'ui\', message=\'The check has been stopped.\')\n
-    elif state == \'delivered\':\n
-      msg = Message(domain=\'ui\', message=\'The check has already been cashed.\')\n
-    elif state == \'stopped\':\n
-      msg = Message(domain=\'ui\', message=\'The check is stopped.\')\n
-    raise ValidationFailed, (msg,)\n
-else:\n
-  msg = Message(domain=\'ui\', message=\'Duplicate checks for the same check number\')\n
-  raise ValidationFailed, (msg,)\n
+transaction.Base_checkCheck(reference=check_number, bank_account=bank_account)\n
 \n
 context.updateBankingOperation(state_change)\n
 
@@ -237,11 +207,6 @@
                             <string>bank_account</string>
                             <string>check_number</string>
                             <string>context</string>
-                            <string>result</string>
-                            <string>now</string>
-                            <string>stop_date</string>
-                            <string>check</string>
-                            <string>state</string>
                           </tuple>
                         </value>
                     </item>

Modified: erp5/trunk/bt5/erp5_banking_check/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_banking_check/bt/revision?rev=14532&r1=14531&r2=14532&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_banking_check/bt/revision (original)
+++ erp5/trunk/bt5/erp5_banking_check/bt/revision Mon May 21 18:02:02 2007
@@ -1,1 +1,1 @@
-199
+201




More information about the Erp5-report mailing list