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):
**{'%s.simulation_state' % (table, ):
simulation_state})
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',
**{'%s.simulation_state' % (table, ):
input_simulation_state})
......@@ -224,7 +233,16 @@ class SimulationTool(BaseTool):
input_simulation_query,
operator='AND')
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',
**{'%s.simulation_state' % (table, ):
output_simulation_state})
......@@ -344,11 +362,29 @@ class SimulationTool(BaseTool):
OR %(query_table)s.payment_uid IS NOT NULL \
" % {'query_table': query_table}
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,
operator='AND')
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:
omit_query = ComplexQuery(quantity_query, condition_expression,
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