Commit 9d29b906 authored by Vincent Pelletier's avatar Vincent Pelletier

erp5_accounting: Give a None selection_domain instead of an empty dict.

Otherwise, the query will include a pointless "node.uid > 0" condition
(because internal API has no choice but to return a condition) which
confuses the query optimiser and may lead to very suboptimal execution
plans: a range scan of node.uid (catalog as node, node.uid=stock.node_uid)
despite provided account uid list constraining stock.node_uid.
parent 89f86f4c
......@@ -217,7 +217,7 @@ if from_date or is_pl_account:
from_date=from_date,
initial_running_total_price=net_balance,
# initial_running_quantity=net_balance, TODO
selection_domain=context.portal_selections.getSelectionDomainDictFor(selection_name),
selection_domain=context.portal_selections.getSelectionDomainDictFor(selection_name) or None,
sort_on=sort_on,
ignore_group_by=True,
**params))
......@@ -228,7 +228,7 @@ return portal.portal_simulation.getMovementHistoryList(
from_date=from_date,
initial_running_total_price=net_balance,
# initial_running_quantity=net_balance, TODO
selection_domain=context.portal_selections.getSelectionDomainDictFor(selection_name),
selection_domain=context.portal_selections.getSelectionDomainDictFor(selection_name) ir None,
sort_on=sort_on,
ignore_group_by=True,
src__=src__,
......
......@@ -90,7 +90,7 @@ if period_start_date and params.get('node_uid'):
# beginning of period to the from_date
at_date = params.pop('at_date', None)
period_openning_balance = getInventory(
selection_domain=getSelectionDomainDictFor(selection_name),
selection_domain=getSelectionDomainDictFor(selection_name) or None,
to_date=period_start_date,
**params)
if omit_asset_decrease:
......@@ -111,5 +111,5 @@ if period_start_date and params.get('node_uid'):
return getInventory(
omit_asset_increase=omit_asset_increase,
omit_asset_decrease=omit_asset_decrease,
selection_domain=getSelectionDomainDictFor(selection_name),
selection_domain=getSelectionDomainDictFor(selection_name) or None,
**params)
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