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

nobody at svn.erp5.org nobody at svn.erp5.org
Wed May 26 16:19:46 CEST 2010


Author: jerome
Date: Wed May 26 16:19:44 2010
New Revision: 35650

URL: http://svn.erp5.org?rev=35650&view=rev
Log:
be more robust if start date is not defined, and do not reindex in deleted
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=35650&r1=35649&r2=35650&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/BalanceTransaction.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/BalanceTransaction.py [utf8] Wed May 26 16:19:44 2010
@@ -153,8 +153,11 @@
           self.getDestinationSectionValue().getPriceCurrencyValue()
       if accounting_currency is not None:
         precision = accounting_currency.getQuantityPrecision()
+    inventory_date = self.getStartDate()
+    if inventory_date:
+      inventory_date = inventory_date.earliestTime()
     default_inventory_params = dict(
-                        to_date=self.getStartDate().earliestTime(),
+                        to_date=inventory_date,
                         section_uid=section_uid,
                         precision=precision,
                         portal_type=self.getPortalAccountingMovementTypeList(),
@@ -452,7 +455,8 @@
     sql_catalog_id = kw.pop("sql_catalog_id", None)
     disable_archive = kw.pop("disable_archive", 0)
 
-    if self.getSimulationState() in self.getPortalDraftOrderStateList():
+    if self.getSimulationState() in self.getPortalDraftOrderStateList() + (
+                                            'deleted',):
       # this prevent from trying to calculate stock
       # with not all properties defined and thus making
       # request with no condition in mysql
@@ -462,7 +466,7 @@
                     object_list,
                     sql_catalog_id = sql_catalog_id,
                     disable_archive=disable_archive,
-                    immediate_reindex_archive=immediate_reindex_archive)      
+                    immediate_reindex_archive=immediate_reindex_archive)
       return
 
     current_stock_dict = self._getCurrentStockDict()




More information about the Erp5-report mailing list