[Erp5-report] r25283 - /erp5/trunk/products/ERP5/Document/BalanceTransaction.py

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Jan 23 15:31:09 CET 2009


Author: romain
Date: Fri Jan 23 15:31:07 2009
New Revision: 25283

URL: http://svn.erp5.org?rev=25283&view=rev
Log:
Do not compute stock calculation when Balance Transaction is in draft state.

Modified:
    erp5/trunk/products/ERP5/Document/BalanceTransaction.py

Modified: erp5/trunk/products/ERP5/Document/BalanceTransaction.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/BalanceTransaction.py?rev=25283&r1=25282&r2=25283&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/BalanceTransaction.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/BalanceTransaction.py [utf8] Fri Jan 23 15:31:07 2009
@@ -450,6 +450,22 @@
     Also this uses total_price (and quantity), and ignores variations and
     subvariations as it does not exist in accounting.
     """
+    sql_catalog_id = kw.pop("sql_catalog_id", None)
+    disable_archive = kw.pop("disable_archive", 0)
+
+    if self.getSimulationState() in self.getPortalDraftOrderStateList():
+      # this prevent from trying to calculate stock
+      # with not all properties defined and thus making
+      # request with no condition in mysql
+      object_list = [self]
+      immediate_reindex_archive = sql_catalog_id is not None
+      self.portal_catalog.catalogObjectList(
+                    object_list,
+                    sql_catalog_id = sql_catalog_id,
+                    disable_archive=disable_archive,
+                    immediate_reindex_archive=immediate_reindex_archive)      
+      return
+
     current_stock_dict = self._getCurrentStockDict()
     new_stock_dict = self._getNewStockDict()
     diff_list = self._computeStockDifferenceList(




More information about the Erp5-report mailing list