[Erp5-report] r12876 - in /erp5/trunk/bt5/erp5_accounting: SkinTemplateItem/portal_skins/er...

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Feb 19 11:10:18 CET 2007


Author: jerome
Date: Mon Feb 19 11:10:14 2007
New Revision: 12876

URL: http://svn.erp5.org?rev=12876&view=rev
Log:
AccountingTransactionModule_createRelatedPaymentTransactionList:
  Refuse to create payment if payment creation is already in progress.
Invoice_createRelatedPaymentTransaction:
  Make sure we don't create an empty transaction.


Modified:
    erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_createRelatedPaymentTransactionList.xml
    erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Invoice_createRelatedPaymentTransaction.xml
    erp5/trunk/bt5/erp5_accounting/bt/revision

Modified: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_createRelatedPaymentTransactionList.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_createRelatedPaymentTransactionList.xml?rev=12876&r1=12875&r2=12876&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_createRelatedPaymentTransactionList.xml (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_createRelatedPaymentTransactionList.xml Mon Feb 19 11:10:14 2007
@@ -74,6 +74,7 @@
 portal = context.getPortalObject()\n
 stool = portal.portal_selections\n
 getObject = portal.portal_catalog.getObject\n
+countMessage = portal.portal_activities.countMessage\n
 invoice_type_list = portal.getPortalInvoiceTypeList()\n
 N_ = lambda msg, **kw: Message(\'erp5_ui\', msg, **kw)\n
 \n
@@ -92,17 +93,23 @@
                       payment_for_related_payment=payment))\n
 \n
 # XXX prevent to call this on the whole module:\n
-if len(object_list) > 100:\n
+if len(object_list) >= 1000:\n
   return context.REQUEST.RESPONSE.redirect(\n
     "%s/view?portal_status_message=%s" % (\n
         context.absolute_url(), N_(\n
-         \'Refusing to process more than 100 objects, check your selection\')))\n
+         \'Refusing to process more than 1000 objects, check your selection\')))\n
 \n
 tag = \'payment_creation_%s\' % portal.portal_ids.generateNewLongId()\n
 activated = 0\n
 for obj in object_list:\n
   if obj.portal_type in invoice_type_list:\n
-    obj.getObject().activate(tag=tag).Invoice_createRelatedPaymentTransaction(\n
+    obj = obj.getObject()\n
+    if countMessage(path=obj.getPath(),\n
+                    method_id=\'Invoice_createRelatedPaymentTransaction\'):\n
+      raise \'Redirect\', "%s/view?portal_status_message=%s" % (\n
+                context.absolute_url(), N_(\'Payment Creation already in\'\n
+                \' progress, abandon\'))\n
+    obj.activate(tag=tag).Invoice_createRelatedPaymentTransaction(\n
                                                   node=node,\n
                                                   payment_mode=payment_mode,\n
                                                   payment=payment,\n
@@ -182,6 +189,7 @@
                             <string>portal</string>
                             <string>stool</string>
                             <string>getObject</string>
+                            <string>countMessage</string>
                             <string>invoice_type_list</string>
                             <string>N_</string>
                             <string>selection_uid_list</string>

Modified: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Invoice_createRelatedPaymentTransaction.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Invoice_createRelatedPaymentTransaction.xml?rev=12876&r1=12875&r2=12876&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Invoice_createRelatedPaymentTransaction.xml (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Invoice_createRelatedPaymentTransaction.xml Mon Feb 19 11:10:14 2007
@@ -89,6 +89,20 @@
           params=dict(node_for_related_payment=node,\n
                       payment_mode_for_related_payment=payment_mode,\n
                       payment_for_related_payment=payment))\n
+\n
+\n
+# Calculate the payable/receivable quantity, using\n
+# Invoice_getRemainingTotalPayablePrice script.\n
+total_payable_price_details = \\\n
+          context.Invoice_getRemainingTotalPayablePrice(detailed=True)\n
+\n
+# if there\'s nothing more to pay, don\'t create an empty transaction\n
+if sum(total_payable_price_per_node_section.values()) == 0:\n
+  if not batch_mode:\n
+    return context.REQUEST.RESPONSE.redirect(\n
+      "%s/view?portal_status_message=%s" % (\n
+        context.absolute_url(), N_(\'Nothing more to pay\')))\n
+  return None\n
 \n
 related_payment = portal.accounting_module.newContent(\n
   portal_type="Payment Transaction",\n
@@ -122,10 +136,6 @@
 )\n
 bank_quantity = 0\n
 \n
-# Calculate the payable/receivable quantity, using\n
-# Invoice_getRemainingTotalPayablePrice script.\n
-total_payable_price_details = \\\n
-          context.Invoice_getRemainingTotalPayablePrice(detailed=True)\n
 for (line_node, line_mirror_section), quantity in\\\n
                         total_payable_price_details.items():\n
   if line_mirror_section == mirror_section:\n
@@ -216,6 +226,11 @@
                             <string>is_source</string>
                             <string>line_portal_type</string>
                             <string>dict</string>
+                            <string>True</string>
+                            <string>total_payable_price_details</string>
+                            <string>sum</string>
+                            <string>total_payable_price_per_node_section</string>
+                            <string>None</string>
                             <string>str</string>
                             <string>unicode</string>
                             <string>related_payment</string>
@@ -223,8 +238,6 @@
                             <string>mirror_section</string>
                             <string>bank</string>
                             <string>bank_quantity</string>
-                            <string>True</string>
-                            <string>total_payable_price_details</string>
                             <string>_getiter_</string>
                             <string>line_node</string>
                             <string>line_mirror_section</string>

Modified: erp5/trunk/bt5/erp5_accounting/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/bt/revision?rev=12876&r1=12875&r2=12876&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/bt/revision (original)
+++ erp5/trunk/bt5/erp5_accounting/bt/revision Mon Feb 19 11:10:14 2007
@@ -1,1 +1,1 @@
-186
+187




More information about the Erp5-report mailing list