[Erp5-report] r13945 - in /erp5/trunk/bt5/erp5_banking_core: SkinTemplateItem/portal_skins/...

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Apr 4 21:52:34 CEST 2007


Author: seb
Date: Wed Apr  4 21:52:31 2007
New Revision: 13945

URL: http://svn.erp5.org?rev=13945&view=rev
Log:
Make CashDelivery_checkCounterInventory using activities in order that there is no operation being reindexed

Added:
    erp5/trunk/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/BankAccount_getReportInformationList.xml
    erp5/trunk/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/BankAccount_getReportTransactionList.xml
Modified:
    erp5/trunk/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CashDelivery_checkCounterInventory.xml
    erp5/trunk/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CounterModule_getVaultTransactionList.xml
    erp5/trunk/bt5/erp5_banking_core/bt/revision

Added: erp5/trunk/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/BankAccount_getReportInformationList.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/BankAccount_getReportInformationList.xml?rev=13945&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/BankAccount_getReportInformationList.xml (added)
+++ erp5/trunk/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/BankAccount_getReportInformationList.xml Wed Apr  4 21:52:31 2007
@@ -1,0 +1,199 @@
+<?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>from Products.ERP5Type.Message import Message\n
+account = None\n
+portal = context.getPortalObject()\n
+catalog = portal.portal_catalog\n
+portal_type = "Bank Account"\n
+\n
+if reference is None:\n
+  message = Message(domain="ui", message="Please give a reference")\n
+  raise ValueError, message\n
+\n
+account_list = catalog(reference=reference, portal_type=portal_type)\n
+if len(account_list) == 0:\n
+  account_list = catalog(reference="%%%s%%" % reference, portal_type=portal_type)\n
+if len(account_list) == 0:\n
+  message = Message(domain="ui", message="No bank account have this reference")\n
+  raise ValueError, message\n
+\n
+account_list = [x.getObject() for x in account_list]\n
+\n
+if total_price:\n
+  tmp_dict = {}\n
+  new_list = []\n
+  for account in account_list:\n
+    quantity = account.BankAccount_getCurrentPosition()\n
+    tmp_dict[\'total_price\'] = quantity\n
+    new_list.append(account.asContext(**tmp_dict))\n
+  account_list = new_list\n
+\n
+return account_list\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>reference=None, total_price=0</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>reference</string>
+                            <string>total_price</string>
+                            <string>Products.ERP5Type.Message</string>
+                            <string>Message</string>
+                            <string>None</string>
+                            <string>account</string>
+                            <string>_getattr_</string>
+                            <string>context</string>
+                            <string>portal</string>
+                            <string>catalog</string>
+                            <string>portal_type</string>
+                            <string>message</string>
+                            <string>ValueError</string>
+                            <string>account_list</string>
+                            <string>len</string>
+                            <string>append</string>
+                            <string>$append0</string>
+                            <string>_getiter_</string>
+                            <string>x</string>
+                            <string>tmp_dict</string>
+                            <string>new_list</string>
+                            <string>quantity</string>
+                            <string>_write_</string>
+                            <string>_apply_</string>
+                          </tuple>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_defaults</string> </key>
+            <value>
+              <tuple>
+                <none/>
+                <int>0</int>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>BankAccount_getReportInformationList</string> </value>
+        </item>
+        <item>
+            <key> <string>warnings</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>

Added: erp5/trunk/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/BankAccount_getReportTransactionList.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/BankAccount_getReportTransactionList.xml?rev=13945&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/BankAccount_getReportTransactionList.xml (added)
+++ erp5/trunk/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/BankAccount_getReportTransactionList.xml Wed Apr  4 21:52:31 2007
@@ -1,0 +1,229 @@
+<?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>from Products.ERP5Type.Document import newTempBase\n
+\n
+if reference is None:\n
+  account_list = [context]\n
+else:\n
+  account_list = context.BankAccount_getReportInformationList(reference=reference)\n
+\n
+\n
+\n
+# Build the common inventory dict\n
+params = {}\n
+if from_date is not None:\n
+  params[\'from_date\'] = from_date\n
+if at_date is not None:\n
+  params[\'at_date\'] = at_date\n
+\n
+\n
+account_dict = {}\n
+for account in account_list:\n
+  account_dict[account.getUid()] = account\n
+\n
+inventory_list = context.portal_simulation.getCurrentInventoryList(\n
+                                                          payment_uid = account_dict.keys()\n
+                                                          , **params\n
+                                                          )\n
+\n
+final_inventory_list = []\n
+portal = account.getPortalObject()\n
+i = 0\n
+for inventory in inventory_list:\n
+  tmp_dict = {}\n
+  movement = portal.restrictedTraverse(inventory.path)\n
+  delivery = movement.getExplanationValue()\n
+  source_reference = delivery.getSourceReference()\n
+  tmp_dict[\'source_reference\'] = source_reference\n
+  tmp_dict[\'total_price\'] = inventory.total_price\n
+  tmp_dict[\'description\'] = delivery.getDescription()\n
+  tmp_dict[\'start_date\'] = delivery.getStartDate()\n
+  account = account_dict[inventory.payment_uid]\n
+  tmp_dict[\'reference\'] = account.getReference()\n
+  final_inventory_list.append(newTempBase(account, "new_%03i" % i, **tmp_dict))\n
+  i += 1\n
+\n
+\n
+def sort_date(a,b):\n
+  result = cmp(a.reference,b.reference)\n
+  if result == 0:\n
+    result = cmp(a.start_date,b.start_date)\n
+  return result\n
+\n
+final_inventory_list.sort(sort_date)\n
+\n
+return final_inventory_list\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>from_date=None, to_date=None, at_date=None, reference=None</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>4</int> </value>
+                    </item>
+                    <item>
+                        <key> <string>co_varnames</string> </key>
+                        <value>
+                          <tuple>
+                            <string>from_date</string>
+                            <string>to_date</string>
+                            <string>at_date</string>
+                            <string>reference</string>
+                            <string>Products.ERP5Type.Document</string>
+                            <string>newTempBase</string>
+                            <string>None</string>
+                            <string>context</string>
+                            <string>account_list</string>
+                            <string>_getattr_</string>
+                            <string>params</string>
+                            <string>_write_</string>
+                            <string>account_dict</string>
+                            <string>_getiter_</string>
+                            <string>account</string>
+                            <string>_apply_</string>
+                            <string>inventory_list</string>
+                            <string>final_inventory_list</string>
+                            <string>portal</string>
+                            <string>i</string>
+                            <string>inventory</string>
+                            <string>tmp_dict</string>
+                            <string>movement</string>
+                            <string>delivery</string>
+                            <string>source_reference</string>
+                            <string>_getitem_</string>
+                            <string>_inplacevar_</string>
+                            <string>sort_date</string>
+                          </tuple>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_defaults</string> </key>
+            <value>
+              <tuple>
+                <none/>
+                <none/>
+                <none/>
+                <none/>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>BankAccount_getReportTransactionList</string> </value>
+        </item>
+        <item>
+            <key> <string>warnings</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>

Modified: erp5/trunk/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CashDelivery_checkCounterInventory.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CashDelivery_checkCounterInventory.xml?rev=13945&r1=13944&r2=13945&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CashDelivery_checkCounterInventory.xml (original)
+++ erp5/trunk/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CashDelivery_checkCounterInventory.xml Wed Apr  4 21:52:31 2007
@@ -86,7 +86,10 @@
 line_list = []\n
 for l in tmp_list :\n
   # The source can be different for every line (due to getBaobabSource approach)\n
-  source_counter = source or l.getBaobabSource()\n
+  if source is None:\n
+    source_counter = l.getBaobabSource()\n
+  else:\n
+    source_counter = source\n
   # test if resource is a currency_cash\n
   try:\n
     if (l.getResourceValue().getPortalType() in currency_cash_portal_type_list) \\\n
@@ -103,10 +106,30 @@
 if no_balance_check:\n
   return 0\n
 \n
+serialize_dict = {}\n
+\n
+activity_tool = context.portal_activities\n
+def checkActivities(line,source_counter):\n
+  if activity_tool.countMessageWithTag(source_counter):\n
+    msg = Message(domain=\'ui\', message="There are operations pending for this vault that prevent form calculating its position. Please try again later.")\n
+    raise ValidationFailed, (msg,)\n
+\n
+\n
 for line in line_list :\n
   line_resource = line.getResource()\n
   # The source can be different for every line (due to getBaobabSource approach)\n
-  source_counter = source or line.getBaobabSource()\n
+  if source is None:\n
+    source_counter = line.getBaobabSource()\n
+  else:\n
+    source_counter = source\n
+  # Make sure there is no reindex with the tag of this counter\n
+  if not serialize_dict.has_key(source_counter):\n
+    serialize_dict[key] = 1\n
+    source_object = context.portal_categories.getCategoryValue(source_counter)\n
+    source_object.serialize()\n
+  # Reindex this line with this particular source_counter tag\n
+  activate_kw = {\'tag\':source_counter}\n
+  line.reindexObject(activate_kw=activate_kw)\n
   if line.hasCellContent() :\n
     for cell in line.objectValues() :\n
       variation_text = cell.getVariationText()\n
@@ -201,12 +224,20 @@
                             <string>line_list</string>
                             <string>_getiter_</string>
                             <string>l</string>
+                            <string>None</string>
                             <string>source_counter</string>
                             <string>AttributeError</string>
                             <string>KeyError</string>
                             <string>len</string>
+                            <string>serialize_dict</string>
+                            <string>activity_tool</string>
+                            <string>checkActivities</string>
                             <string>line</string>
                             <string>line_resource</string>
+                            <string>_write_</string>
+                            <string>key</string>
+                            <string>source_object</string>
+                            <string>activate_kw</string>
                             <string>cell</string>
                             <string>variation_text</string>
                             <string>inventory_value</string>

Modified: erp5/trunk/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CounterModule_getVaultTransactionList.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CounterModule_getVaultTransactionList.xml?rev=13945&r1=13944&r2=13945&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CounterModule_getVaultTransactionList.xml (original)
+++ erp5/trunk/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CounterModule_getVaultTransactionList.xml Wed Apr  4 21:52:31 2007
@@ -235,7 +235,7 @@
       tmp_dict.update({\'date\':resource_in_vault[\'date\']})\n
     general_total_price += resource_in_vault[\'total_price\']\n
   tmp_dict[\'general_total_price\'] = general_total_price\n
-  total_inventory_list.append(newTempBase(context, "new_%3i" % i, **tmp_dict))\n
+  total_inventory_list.append(newTempBase(context, "new_%03i" % i, **tmp_dict))\n
   i += 1\n
 \n
 def sort_base_price(a,b):\n
@@ -343,6 +343,7 @@
                             <string>KeyError</string>
                             <string>general_total_price</string>
                             <string>resource_in_vault</string>
+                            <string>_inplacevar_</string>
                             <string>sort_base_price</string>
                             <string>repr</string>
                             <string>append</string>

Modified: erp5/trunk/bt5/erp5_banking_core/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_banking_core/bt/revision?rev=13945&r1=13944&r2=13945&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_banking_core/bt/revision (original)
+++ erp5/trunk/bt5/erp5_banking_core/bt/revision Wed Apr  4 21:52:31 2007
@@ -1,1 +1,1 @@
-181
+183




More information about the Erp5-report mailing list