[Erp5-report] r40264 vincent - in /erp5/trunk/bt5/erp5_banking_core: SkinTemplateItem/porta...

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Nov 15 11:26:30 CET 2010


Author: vincent
Date: Mon Nov 15 11:26:30 2010
New Revision: 40264

URL: http://svn.erp5.org?rev=40264&view=rev
Log:
It is not required to pass resource parameter to getAvailableInventory when called on a resource.

Also, remove unuder variable.
Also, de-duplicate code from BankAccount_checkAvailableBalance.

Modified:
    erp5/trunk/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/BankAccount_checkAvailableBalance.xml
    erp5/trunk/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/BankAccount_checkBalance.xml
    erp5/trunk/bt5/erp5_banking_core/bt/revision

Modified: erp5/trunk/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/BankAccount_checkAvailableBalance.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/BankAccount_checkAvailableBalance.xml?rev=40264&r1=40263&r2=40264&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/BankAccount_checkAvailableBalance.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/BankAccount_checkAvailableBalance.xml [utf8] Mon Nov 15 11:26:30 2010
@@ -10,10 +10,22 @@
     <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>
@@ -53,44 +65,8 @@
         </item>
         <item>
             <key> <string>_body</string> </key>
-            <value> <string encoding="cdata"><![CDATA[
-
-# check that the amount of `resource` in account `payment` is greater than or equal to `quantity`\n
-\n
-# returns a dictionnary like : {\'error_code\', \'balance\'}\n
-\n
-#workflow_id = \'bank_account_workflow\'\n
-manual_validation_account_category_list = (\'test\',)\n
-\n
-# First check that the payment account is in an acceptable state\n
-#payment_state = context.portal_workflow.getInfoFor(ob=payment, name=\'simulation_state\', wf_id=workflow_id)\n
-payment_value = context.restrictedTraverse(payment)\n
-\n
-if not payment_value.BankAccount_isOpened():\n
-  return {\'error_code\':2} # closed account\n
-\n
-resource = payment_value.getPriceCurrencyValue()\n
-\n
-if resource is None :\n
-  raise AttributeError, \'No currency defined on %s\' % payment\n
-\n
-# Next, check the balance of the account\n
-account_balance = resource.getAvailableInventory(payment=payment, src__=src__)\n
-# context.log("account balance",account_balance)\n
-# context.log("resource payement", str((resource,payment)))\n
-if src__ :\n
-  return account_balance \n
-\n
-if account_balance - quantity < 0 :\n
-#  if payment.getBankAccountType() in manual_validation_account_category_list :\n
-#    return {\'error_code\':3, \'balance\':account_balance} # manual_validation\n
-\n
-  return {\'error_code\':1, \'balance\':account_balance} # insufficient balance\n
-\n
-return {\'error_code\':0, \'balance\':account_balance} # ok\n
-
-
-]]></string> </value>
+            <value> <string>return context.BankAccount_checkBalance(payment, quantity, src__=src__)\n
+</string> </value>
         </item>
         <item>
             <key> <string>_code</string> </key>
@@ -99,15 +75,19 @@ return {\'error_code\':0, \'balance\':ac
             </value>
         </item>
         <item>
+            <key> <string>_filepath</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
             <key> <string>_params</string> </key>
             <value> <string>payment, quantity, src__=0</string> </value>
         </item>
         <item>
             <key> <string>_proxy_roles</string> </key>
             <value>
-              <tuple>
-                <string>Manager</string>
-              </tuple>
+              <tuple/>
             </value>
         </item>
         <item>
@@ -137,14 +117,8 @@ return {\'error_code\':0, \'balance\':ac
                             <string>payment</string>
                             <string>quantity</string>
                             <string>src__</string>
-                            <string>manual_validation_account_category_list</string>
                             <string>_getattr_</string>
                             <string>context</string>
-                            <string>payment_value</string>
-                            <string>resource</string>
-                            <string>None</string>
-                            <string>AttributeError</string>
-                            <string>account_balance</string>
                           </tuple>
                         </value>
                     </item>

Modified: erp5/trunk/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/BankAccount_checkBalance.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/BankAccount_checkBalance.xml?rev=40264&r1=40263&r2=40264&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/BankAccount_checkBalance.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/BankAccount_checkBalance.xml [utf8] Mon Nov 15 11:26:30 2010
@@ -10,10 +10,22 @@
     <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>
@@ -58,8 +70,6 @@
 # check that the amount of `resource` in account `payment` is greater than or equal to `quantity`\n
 # returns a dictionnary like : {\'error_code\', \'balance\'}\n
 \n
-manual_validation_account_category_list = (\'test\',)\n
-\n
 # First check that the payment account is in an acceptable state\n
 payment_value = context.restrictedTraverse(payment)\n
 \n
@@ -72,8 +82,7 @@ if resource is None :\n
   raise AttributeError, \'No currency defined on %s\' % payment\n
 \n
 # Next, check the balance of the account\n
-# We must specify the resource !\n
-account_balance = resource.getAvailableInventory(payment=payment, resource=resource.getRelativeUrl(),src__=src__)\n
+account_balance = resource.getAvailableInventory(payment=payment, src__=src__)\n
 if src__ :\n
   return account_balance \n
 \n
@@ -92,6 +101,12 @@ return {\'error_code\':0, \'balance\':ac
             </value>
         </item>
         <item>
+            <key> <string>_filepath</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
             <key> <string>_params</string> </key>
             <value> <string>payment, quantity, src__=0</string> </value>
         </item>
@@ -130,7 +145,6 @@ return {\'error_code\':0, \'balance\':ac
                             <string>payment</string>
                             <string>quantity</string>
                             <string>src__</string>
-                            <string>manual_validation_account_category_list</string>
                             <string>_getattr_</string>
                             <string>context</string>
                             <string>payment_value</string>

Modified: erp5/trunk/bt5/erp5_banking_core/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_banking_core/bt/revision?rev=40264&r1=40263&r2=40264&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_banking_core/bt/revision [utf8] (original)
+++ erp5/trunk/bt5/erp5_banking_core/bt/revision [utf8] Mon Nov 15 11:26:30 2010
@@ -1 +1 @@
-548
\ No newline at end of file
+549




More information about the Erp5-report mailing list