Commit 90cb2422 authored by Łukasz Nowak's avatar Łukasz Nowak

- add tests for getAggregatedAmountList in specialised order

 - if it is possible to fetch explanation for context use it to find contained Trade Mode Lines


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@26757 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 50dc55a5
......@@ -105,7 +105,10 @@ class TradeCondition(Path, Transformation):
trade_model_line_composed_list = []
containting_object_list = []
if context is not None:
containting_object_list.append(context)
document = context
if getattr(context, 'getExplanationValue', None) is not None:
document = context.getExplanationValue()
containting_object_list.append(document)
containting_object_list.extend(findSpecialiseValueList(self))
for specialise in containting_object_list:
......
......@@ -1096,11 +1096,15 @@ class TestBPMMixin(ERP5TypeTestCase):
order_line_discounted_taxed = order_line
)
def createTradeModelLine(self, trade_condition, **kw):
return trade_condition.newContent(
def createTradeModelLine(self, document, **kw):
return document.newContent(
portal_type='Trade Model Line',
**kw)
def stepOrderCreateTradeModelLine(self, sequence=None, **kw):
order = sequence.get('order')
sequence.edit(trade_model_line = self.createTradeModelLine(order))
def stepCreateTradeModelLine(self, sequence=None, **kw):
trade_condition = sequence.get('trade_condition')
sequence.edit(trade_model_line = self.createTradeModelLine(trade_condition))
......@@ -1519,6 +1523,48 @@ class TestBPMTestCases(TestBPMMixin):
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
order_specialise_aggregated_amount_common_sequence_string = \
common_documents_creation + """
CreateBusinessProcess
CreateBusinessState
ModifyBusinessStateTaxed
CreateBusinessState
ModifyBusinessStateInvoiced
CreateBusinessPath
ModifyBusinessPathTaxing
CreateBusinessPath
ModifyBusinessPathDiscounting
CreateTradeCondition
SpecialiseTradeConditionWithBusinessProcess
CreateTradeModelLine
ModifyTradeModelLineTax
Tic
CreateOrder
OrderCreateTradeModelLine
ModifyTradeModelLineDiscount
SpecialiseOrderTradeCondition
FillOrder
Tic
CreateOrderLine
ModifyOrderLineTaxed
CreateOrderLine
ModifyOrderLineDiscounted
CreateOrderLine
ModifyOrderLineDiscountedTaxed
Tic
""" + aggregated_amount_list_check
def test_getAggreagtedAmountListOrderSpecialise(self):
"""
Test for case, when discount contributes to tax, and order has mix of contributing lines and order itself defines Trade Model Line
"""
sequence_list = SequenceList()
sequence_string = self\
.order_specialise_aggregated_amount_common_sequence_string
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_getAggreagtedAmountList_afterUpdateAggregatedAmountList(self):
"""
Test for case, when discount contributes to tax, and order has mix of contributing lines
......@@ -1569,6 +1615,34 @@ class TestBPMTestCases(TestBPMMixin):
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
trade_model_rule_simulation_common_order_specialised_string = \
order_specialise_aggregated_amount_common_sequence_string + """
Tic
PlanOrder
Tic
""" + aggregated_amount_simulation_check
def test_TradeModelRuleSimulationExpandOrderSpecialise(self):
"""Tests tree of simulations from Trade Model Rule"""
sequence_list = SequenceList()
sequence_string = self \
.trade_model_rule_simulation_common_order_specialised_string
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_TradeModelRuleSimulationReexpandOrderSpecialise(self):
"""Tests tree of simulations from Trade Model Rule with reexpanding"""
sequence_list = SequenceList()
sequence_string = self \
.trade_model_rule_simulation_common_order_specialised_string+ """
ModifyAgainOrderLineTaxed
ModifyAgainOrderLineDiscounted
ModifyAgainOrderLineDiscountedTaxed
Tic
""" + self.aggregated_amount_simulation_check
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_TradeModelRuleSimulationWithoutBPM(self):
"""Tests tree of simulations from Trade Model Rule when there is no BPM"""
sequence_list = SequenceList()
......
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