Commit dbc2a791 authored by Jérome Perrin's avatar Jérome Perrin

be more robust if start date is not defined, and do not reindex in deleted

state


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35650 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e522c903
...@@ -153,8 +153,11 @@ class BalanceTransaction(AccountingTransaction, Inventory): ...@@ -153,8 +153,11 @@ class BalanceTransaction(AccountingTransaction, Inventory):
self.getDestinationSectionValue().getPriceCurrencyValue() self.getDestinationSectionValue().getPriceCurrencyValue()
if accounting_currency is not None: if accounting_currency is not None:
precision = accounting_currency.getQuantityPrecision() precision = accounting_currency.getQuantityPrecision()
inventory_date = self.getStartDate()
if inventory_date:
inventory_date = inventory_date.earliestTime()
default_inventory_params = dict( default_inventory_params = dict(
to_date=self.getStartDate().earliestTime(), to_date=inventory_date,
section_uid=section_uid, section_uid=section_uid,
precision=precision, precision=precision,
portal_type=self.getPortalAccountingMovementTypeList(), portal_type=self.getPortalAccountingMovementTypeList(),
...@@ -452,7 +455,8 @@ class BalanceTransaction(AccountingTransaction, Inventory): ...@@ -452,7 +455,8 @@ class BalanceTransaction(AccountingTransaction, Inventory):
sql_catalog_id = kw.pop("sql_catalog_id", None) sql_catalog_id = kw.pop("sql_catalog_id", None)
disable_archive = kw.pop("disable_archive", 0) 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 # this prevent from trying to calculate stock
# with not all properties defined and thus making # with not all properties defined and thus making
# request with no condition in mysql # request with no condition in mysql
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment