Commit 011f7003 authored by Aurel's avatar Aurel

for Resource_zGetFullInventoryDate, compute date using query thus

range is taken into account


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17854 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e8f1dc0a
...@@ -951,16 +951,24 @@ class SimulationTool(BaseTool): ...@@ -951,16 +951,24 @@ class SimulationTool(BaseTool):
column_id_list = new_column_value_dict.keys() column_id_list = new_column_value_dict.keys()
column_value_list_list = new_column_value_dict.values() column_value_list_list = new_column_value_dict.values()
date_value_list = column_value_dict.get('date', {}).get('query', []) date_value_list = column_value_dict.get('date', {}).get('query', [])
where_expression = None
if len(date_value_list) > 0: if len(date_value_list) > 0:
date = min(date_value_list) date = min(date_value_list)
if isinstance(date, DateTime): if isinstance(date, DateTime):
date = date.ISO() date = date.ISO()
else: # build a query for date to take range into account
date = None date_query_kw = {"inventory.date" : date,
"operator" : column_value_dict.get('date', {}).get('operator', []),
"range" : column_value_dict.get('date', {}).get('range', []),
}
date_query = Query(**date_query_kw)
date_query_result = date_query()
if date_query_result['where_expression'] not in ('',None):
where_expression = date_query_result['where_expression']
return {'group_by_expression': group_by_expression, return {'group_by_expression': group_by_expression,
'column_id_list': column_id_list, 'column_id_list': column_id_list,
'column_value_list_list': column_value_list_list, 'column_value_list_list': column_value_list_list,
'date': date} 'where_expression' : where_expression,}
first_query_param_dict = getFirstQueryParameterDict(new_kw) first_query_param_dict = getFirstQueryParameterDict(new_kw)
if optimisation_success: if optimisation_success:
if len(first_query_param_dict['column_id_list']): if len(first_query_param_dict['column_id_list']):
......
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