Commit 29eb91a5 authored by Jérome Perrin's avatar Jérome Perrin

this should have been part of 27694 (more support for isCancellationAmount).


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27710 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 20291df7
...@@ -216,7 +216,16 @@ class SimulationTool(BaseTool): ...@@ -216,7 +216,16 @@ class SimulationTool(BaseTool):
**{'%s.simulation_state' % (table, ): **{'%s.simulation_state' % (table, ):
simulation_state}) simulation_state})
elif input_simulation_state is not None: elif input_simulation_state is not None:
input_quantity_query = Query(**{'%s.quantity' % (table, ): '>0'}) input_quantity_query = ComplexQuery(
ComplexQuery(
Query(**{'%s.quantity' % table: '>0'}),
Query(**{'%s.is_cancellation' % table: 0}),
operator='AND'),
ComplexQuery(
Query(**{'%s.quantity' % table: '<0'}),
Query(**{'%s.is_cancellation' % table: 1}),
operator='AND'),
operator='OR')
input_simulation_query = Query(operator='IN', input_simulation_query = Query(operator='IN',
**{'%s.simulation_state' % (table, ): **{'%s.simulation_state' % (table, ):
input_simulation_state}) input_simulation_state})
...@@ -224,7 +233,16 @@ class SimulationTool(BaseTool): ...@@ -224,7 +233,16 @@ class SimulationTool(BaseTool):
input_simulation_query, input_simulation_query,
operator='AND') operator='AND')
if output_simulation_state is not None: if output_simulation_state is not None:
output_quantity_query = Query(**{'%s.quantity' % (table, ): '<0'}) output_quantity_query = ComplexQuery(
ComplexQuery(
Query(**{'%s.quantity' % table: '<0'}),
Query(**{'%s.is_cancellation' % table: 0}),
operator='AND'),
ComplexQuery(
Query(**{'%s.quantity' % table: '>0'}),
Query(**{'%s.is_cancellation' % table: 1}),
operator='AND'),
operator='OR')
output_simulation_query = Query(operator='IN', output_simulation_query = Query(operator='IN',
**{'%s.simulation_state' % (table, ): **{'%s.simulation_state' % (table, ):
output_simulation_state}) output_simulation_state})
...@@ -344,11 +362,29 @@ class SimulationTool(BaseTool): ...@@ -344,11 +362,29 @@ class SimulationTool(BaseTool):
OR %(query_table)s.payment_uid IS NOT NULL \ OR %(query_table)s.payment_uid IS NOT NULL \
" % {'query_table': query_table} " % {'query_table': query_table}
if omit_input: if omit_input:
quantity_query = Query(**{'%s.quantity' % query_table: '<0'}) quantity_query = ComplexQuery(
ComplexQuery(
Query(**{'%s.quantity' % query_table: '<0'}),
Query(**{'%s.is_cancellation' % query_table: 0}),
operator='AND'),
ComplexQuery(
Query(**{'%s.quantity' % query_table: '>0'}),
Query(**{'%s.is_cancellation' % query_table: 1}),
operator='AND'),
operator='OR')
omit_query = ComplexQuery(quantity_query, condition_expression, omit_query = ComplexQuery(quantity_query, condition_expression,
operator='AND') operator='AND')
if omit_output: if omit_output:
quantity_query = Query(**{'%s.quantity' % query_table: '>0'}) quantity_query = ComplexQuery(
ComplexQuery(
Query(**{'%s.quantity' % query_table: '>0'}),
Query(**{'%s.is_cancellation' % query_table: 0}),
operator='AND'),
ComplexQuery(
Query(**{'%s.quantity' % query_table: '<0'}),
Query(**{'%s.is_cancellation' % query_table: 1}),
operator='AND'),
operator='OR')
if omit_query is None: if omit_query is None:
omit_query = ComplexQuery(quantity_query, condition_expression, omit_query = ComplexQuery(quantity_query, condition_expression,
operator='AND') operator='AND')
......
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