Commit fbe923e0 authored by Łukasz Nowak's avatar Łukasz Nowak

- set quantity ratio on split packing list to nice value

 - add test for case, when ratio on split packing list gives errors
 - suffixed sequence strings with SEQUENCE_STRING
 - use UPPERCASE for some constants


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@26770 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 64df0d56
...@@ -68,7 +68,7 @@ class TestBPMMixin(ERP5TypeTestCase): ...@@ -68,7 +68,7 @@ class TestBPMMixin(ERP5TypeTestCase):
modified_invoice_line_quantity_ratio = modified_order_line_quantity_ratio \ modified_invoice_line_quantity_ratio = modified_order_line_quantity_ratio \
= 2.5 = 2.5
modified_packing_list_line_quantity_ratio = 0.4 modified_packing_list_line_quantity_ratio = 0.5
base_unit_quantity = 0.01 base_unit_quantity = 0.01
...@@ -1317,7 +1317,7 @@ class TestBPMMixin(ERP5TypeTestCase): ...@@ -1317,7 +1317,7 @@ class TestBPMMixin(ERP5TypeTestCase):
) )
class TestBPMTestCases(TestBPMMixin): class TestBPMTestCases(TestBPMMixin):
common_documents_creation = """ COMMON_DOCUMENTS_CREATION_SEQUENCE_STRING = """
CreateServiceTax CreateServiceTax
CreateServiceDiscount CreateServiceDiscount
CreatePriceCurrency CreatePriceCurrency
...@@ -1331,15 +1331,15 @@ class TestBPMTestCases(TestBPMMixin): ...@@ -1331,15 +1331,15 @@ class TestBPMTestCases(TestBPMMixin):
Tic Tic
""" """
aggregated_amount_list_check = """ AGGREGATED_AMOUNT_LIST_CHECK_SEQUENCE_STRING = """
CheckOrderComplexTradeConditionAggregatedAmountList CheckOrderComplexTradeConditionAggregatedAmountList
CheckOrderLineTaxedAggregatedAmountList CheckOrderLineTaxedAggregatedAmountList
CheckOrderLineDiscountedTaxedAggregatedAmountList CheckOrderLineDiscountedTaxedAggregatedAmountList
CheckOrderLineDiscountedAggregatedAmountList CheckOrderLineDiscountedAggregatedAmountList
""" """
aggregated_amount_list_common_sequence_string = \ AGGREGATED_AMOUNT_LIST_COMMON_SEQUENCE_STRING = \
common_documents_creation + """ COMMON_DOCUMENTS_CREATION_SEQUENCE_STRING + """
CreateBusinessProcess CreateBusinessProcess
CreateBusinessState CreateBusinessState
ModifyBusinessStateTaxed ModifyBusinessStateTaxed
...@@ -1367,7 +1367,7 @@ class TestBPMTestCases(TestBPMMixin): ...@@ -1367,7 +1367,7 @@ class TestBPMTestCases(TestBPMMixin):
CreateOrderLine CreateOrderLine
ModifyOrderLineDiscountedTaxed ModifyOrderLineDiscountedTaxed
Tic Tic
""" + aggregated_amount_list_check """ + AGGREGATED_AMOUNT_LIST_CHECK_SEQUENCE_STRING
def test_TradeConditionTradeModelLineCircularComposition(self): def test_TradeConditionTradeModelLineCircularComposition(self):
""" """
...@@ -1518,13 +1518,13 @@ class TestBPMTestCases(TestBPMMixin): ...@@ -1518,13 +1518,13 @@ class TestBPMTestCases(TestBPMMixin):
Test for case, when discount contributes to tax, and order has mix of contributing lines Test for case, when discount contributes to tax, and order has mix of contributing lines
""" """
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = self.aggregated_amount_list_common_sequence_string sequence_string = self.AGGREGATED_AMOUNT_LIST_COMMON_SEQUENCE_STRING
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self) sequence_list.play(self)
order_specialise_aggregated_amount_common_sequence_string = \ ORDER_SPECIALISE_AGGREGATED_AMOUNT_COMMON_SEQUENCE_STRING = \
common_documents_creation + """ COMMON_DOCUMENTS_CREATION_SEQUENCE_STRING + """
CreateBusinessProcess CreateBusinessProcess
CreateBusinessState CreateBusinessState
ModifyBusinessStateTaxed ModifyBusinessStateTaxed
...@@ -1552,7 +1552,7 @@ class TestBPMTestCases(TestBPMMixin): ...@@ -1552,7 +1552,7 @@ class TestBPMTestCases(TestBPMMixin):
CreateOrderLine CreateOrderLine
ModifyOrderLineDiscountedTaxed ModifyOrderLineDiscountedTaxed
Tic Tic
""" + aggregated_amount_list_check """ + AGGREGATED_AMOUNT_LIST_CHECK_SEQUENCE_STRING
def test_getAggreagtedAmountListOrderSpecialise(self): def test_getAggreagtedAmountListOrderSpecialise(self):
""" """
...@@ -1560,7 +1560,7 @@ class TestBPMTestCases(TestBPMMixin): ...@@ -1560,7 +1560,7 @@ class TestBPMTestCases(TestBPMMixin):
""" """
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = self\ sequence_string = self\
.order_specialise_aggregated_amount_common_sequence_string .ORDER_SPECIALISE_AGGREGATED_AMOUNT_COMMON_SEQUENCE_STRING
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self) sequence_list.play(self)
...@@ -1576,57 +1576,57 @@ class TestBPMTestCases(TestBPMMixin): ...@@ -1576,57 +1576,57 @@ class TestBPMTestCases(TestBPMMixin):
not be aggregated. not be aggregated.
""" """
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = self.aggregated_amount_list_common_sequence_string + """ sequence_string = self.AGGREGATED_AMOUNT_LIST_COMMON_SEQUENCE_STRING + """
UpdateAggregatedAmountListOnOrder UpdateAggregatedAmountListOnOrder
Tic Tic
""" + self.aggregated_amount_list_check """ + self.AGGREGATED_AMOUNT_LIST_CHECK_SEQUENCE_STRING
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self) sequence_list.play(self)
aggregated_amount_simulation_check = """ AGGREGATED_AMOUNT_SIMULATION_CHECK_SEQUENCE_STRING = """
CheckOrderLineTaxedSimulation CheckOrderLineTaxedSimulation
CheckOrderLineDiscountedSimulation CheckOrderLineDiscountedSimulation
CheckOrderLineDiscountedTaxedSimulation CheckOrderLineDiscountedTaxedSimulation
""" """
trade_model_rule_simulation_common_string = \ TRADE_MODEL_RULE_SIMULATION_SEQUENCE_STRING = \
aggregated_amount_list_common_sequence_string + """ AGGREGATED_AMOUNT_LIST_COMMON_SEQUENCE_STRING + """
Tic Tic
PlanOrder PlanOrder
Tic Tic
""" + aggregated_amount_simulation_check """ + AGGREGATED_AMOUNT_SIMULATION_CHECK_SEQUENCE_STRING
def test_TradeModelRuleSimulationExpand(self): def test_TradeModelRuleSimulationExpand(self):
"""Tests tree of simulations from Trade Model Rule""" """Tests tree of simulations from Trade Model Rule"""
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = self.trade_model_rule_simulation_common_string sequence_string = self.TRADE_MODEL_RULE_SIMULATION_SEQUENCE_STRING
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self) sequence_list.play(self)
def test_TradeModelRuleSimulationReexpand(self): def test_TradeModelRuleSimulationReexpand(self):
"""Tests tree of simulations from Trade Model Rule with reexpanding""" """Tests tree of simulations from Trade Model Rule with reexpanding"""
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = self.trade_model_rule_simulation_common_string + """ sequence_string = self.TRADE_MODEL_RULE_SIMULATION_SEQUENCE_STRING + """
ModifyAgainOrderLineTaxed ModifyAgainOrderLineTaxed
ModifyAgainOrderLineDiscounted ModifyAgainOrderLineDiscounted
ModifyAgainOrderLineDiscountedTaxed ModifyAgainOrderLineDiscountedTaxed
Tic Tic
""" + self.aggregated_amount_simulation_check """ + self.AGGREGATED_AMOUNT_SIMULATION_CHECK_SEQUENCE_STRING
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self) sequence_list.play(self)
trade_model_rule_simulation_common_order_specialised_string = \ TRADE_MODEL_RULE_SIMULATION_ORDER_SPECIALISED_SEQUENCE_STRING = \
order_specialise_aggregated_amount_common_sequence_string + """ ORDER_SPECIALISE_AGGREGATED_AMOUNT_COMMON_SEQUENCE_STRING + """
Tic Tic
PlanOrder PlanOrder
Tic Tic
""" + aggregated_amount_simulation_check """ + AGGREGATED_AMOUNT_SIMULATION_CHECK_SEQUENCE_STRING
def test_TradeModelRuleSimulationExpandOrderSpecialise(self): def test_TradeModelRuleSimulationExpandOrderSpecialise(self):
"""Tests tree of simulations from Trade Model Rule""" """Tests tree of simulations from Trade Model Rule"""
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = self \ sequence_string = self \
.trade_model_rule_simulation_common_order_specialised_string .TRADE_MODEL_RULE_SIMULATION_ORDER_SPECIALISED_SEQUENCE_STRING
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self) sequence_list.play(self)
...@@ -1634,19 +1634,19 @@ class TestBPMTestCases(TestBPMMixin): ...@@ -1634,19 +1634,19 @@ class TestBPMTestCases(TestBPMMixin):
"""Tests tree of simulations from Trade Model Rule with reexpanding""" """Tests tree of simulations from Trade Model Rule with reexpanding"""
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = self \ sequence_string = self \
.trade_model_rule_simulation_common_order_specialised_string+ """ .TRADE_MODEL_RULE_SIMULATION_ORDER_SPECIALISED_SEQUENCE_STRING+ """
ModifyAgainOrderLineTaxed ModifyAgainOrderLineTaxed
ModifyAgainOrderLineDiscounted ModifyAgainOrderLineDiscounted
ModifyAgainOrderLineDiscountedTaxed ModifyAgainOrderLineDiscountedTaxed
Tic Tic
""" + self.aggregated_amount_simulation_check """ + self.AGGREGATED_AMOUNT_SIMULATION_CHECK_SEQUENCE_STRING
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self) sequence_list.play(self)
def test_TradeModelRuleSimulationWithoutBPM(self): def test_TradeModelRuleSimulationWithoutBPM(self):
"""Tests tree of simulations from Trade Model Rule when there is no BPM""" """Tests tree of simulations from Trade Model Rule when there is no BPM"""
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = self.common_documents_creation + """ sequence_string = self.COMMON_DOCUMENTS_CREATION_SEQUENCE_STRING + """
CreateTradeCondition CreateTradeCondition
CreateTradeModelLine CreateTradeModelLine
ModifyTradeModelLineTax ModifyTradeModelLineTax
...@@ -1668,7 +1668,7 @@ class TestBPMTestCases(TestBPMMixin): ...@@ -1668,7 +1668,7 @@ class TestBPMTestCases(TestBPMMixin):
def test_TradeModelRuleSimulationWithoutTradeCondition(self): def test_TradeModelRuleSimulationWithoutTradeCondition(self):
"""Tests tree of simulations from Trade Model Rule when there is no Trade Condition""" """Tests tree of simulations from Trade Model Rule when there is no Trade Condition"""
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = self.common_documents_creation + """ sequence_string = self.COMMON_DOCUMENTS_CREATION_SEQUENCE_STRING + """
CreateOrder CreateOrder
FillOrder FillOrder
Tic Tic
...@@ -1685,20 +1685,20 @@ class TestBPMTestCases(TestBPMMixin): ...@@ -1685,20 +1685,20 @@ class TestBPMTestCases(TestBPMMixin):
def test_TradeModelRuleSimulationBuildInvoice(self): def test_TradeModelRuleSimulationBuildInvoice(self):
"""Check that invoice lines on invoice are correctly set""" """Check that invoice lines on invoice are correctly set"""
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = self.trade_model_rule_simulation_common_string sequence_string = self.TRADE_MODEL_RULE_SIMULATION_SEQUENCE_STRING
sequence_string += """ sequence_string += """
ConfirmOrder ConfirmOrder
Tic Tic
""" + self.aggregated_amount_simulation_check + """ """ + self.AGGREGATED_AMOUNT_SIMULATION_CHECK_SEQUENCE_STRING + """
GetPackingList GetPackingList
PackPackingList PackPackingList
Tic Tic
""" + self.aggregated_amount_simulation_check + """ """ + self.AGGREGATED_AMOUNT_SIMULATION_CHECK_SEQUENCE_STRING + """
StartPackingList StartPackingList
StopPackingList StopPackingList
DeliverPackingList DeliverPackingList
Tic Tic
""" + self.aggregated_amount_simulation_check + """ """ + self.AGGREGATED_AMOUNT_SIMULATION_CHECK_SEQUENCE_STRING + """
GetInvoice GetInvoice
CheckInvoiceCausalityStateSolved CheckInvoiceCausalityStateSolved
CheckInvoiceNormalMovements CheckInvoiceNormalMovements
...@@ -1710,20 +1710,20 @@ class TestBPMTestCases(TestBPMMixin): ...@@ -1710,20 +1710,20 @@ class TestBPMTestCases(TestBPMMixin):
def test_TradeModelRuleSimulationBuildInvoiceNewTradeConditionDivergencyAndSolving(self): def test_TradeModelRuleSimulationBuildInvoiceNewTradeConditionDivergencyAndSolving(self):
"""Check that after changing trade condition invoice is properly diverged and it is possible to solve""" """Check that after changing trade condition invoice is properly diverged and it is possible to solve"""
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = self.trade_model_rule_simulation_common_string sequence_string = self.TRADE_MODEL_RULE_SIMULATION_SEQUENCE_STRING
sequence_string += """ sequence_string += """
ConfirmOrder ConfirmOrder
Tic Tic
""" + self.aggregated_amount_simulation_check + """ """ + self.AGGREGATED_AMOUNT_SIMULATION_CHECK_SEQUENCE_STRING + """
GetPackingList GetPackingList
PackPackingList PackPackingList
Tic Tic
""" + self.aggregated_amount_simulation_check + """ """ + self.AGGREGATED_AMOUNT_SIMULATION_CHECK_SEQUENCE_STRING + """
StartPackingList StartPackingList
StopPackingList StopPackingList
DeliverPackingList DeliverPackingList
Tic Tic
""" + self.aggregated_amount_simulation_check + """ """ + self.AGGREGATED_AMOUNT_SIMULATION_CHECK_SEQUENCE_STRING + """
GetInvoice GetInvoice
CheckInvoiceCausalityStateSolved CheckInvoiceCausalityStateSolved
CheckInvoiceNormalMovements CheckInvoiceNormalMovements
...@@ -1765,20 +1765,20 @@ class TestBPMTestCases(TestBPMMixin): ...@@ -1765,20 +1765,20 @@ class TestBPMTestCases(TestBPMMixin):
def test_TradeModelRuleSimulationBuildInvoiceInvoiceLineModifyDivergencyAndSolving(self): def test_TradeModelRuleSimulationBuildInvoiceInvoiceLineModifyDivergencyAndSolving(self):
"""Check that after changing invoice line invoice is properly diverged and it is possible to solve""" """Check that after changing invoice line invoice is properly diverged and it is possible to solve"""
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = self.trade_model_rule_simulation_common_string sequence_string = self.TRADE_MODEL_RULE_SIMULATION_SEQUENCE_STRING
sequence_string += """ sequence_string += """
ConfirmOrder ConfirmOrder
Tic Tic
""" + self.aggregated_amount_simulation_check + """ """ + self.AGGREGATED_AMOUNT_SIMULATION_CHECK_SEQUENCE_STRING + """
GetPackingList GetPackingList
PackPackingList PackPackingList
Tic Tic
""" + self.aggregated_amount_simulation_check + """ """ + self.AGGREGATED_AMOUNT_SIMULATION_CHECK_SEQUENCE_STRING + """
StartPackingList StartPackingList
StopPackingList StopPackingList
DeliverPackingList DeliverPackingList
Tic Tic
""" + self.aggregated_amount_simulation_check + """ """ + self.AGGREGATED_AMOUNT_SIMULATION_CHECK_SEQUENCE_STRING + """
GetInvoice GetInvoice
CheckInvoiceCausalityStateSolved CheckInvoiceCausalityStateSolved
CheckInvoiceNormalMovements CheckInvoiceNormalMovements
...@@ -1808,20 +1808,20 @@ class TestBPMTestCases(TestBPMMixin): ...@@ -1808,20 +1808,20 @@ class TestBPMTestCases(TestBPMMixin):
def test_TradeModelRuleSimulationBuildInvoiceBuildInvoiceTransactionLines(self): def test_TradeModelRuleSimulationBuildInvoiceBuildInvoiceTransactionLines(self):
"""Check that having properly configured invoice transaction rule it invoice transaction lines are nicely generated and have proper amounts""" """Check that having properly configured invoice transaction rule it invoice transaction lines are nicely generated and have proper amounts"""
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = self.trade_model_rule_simulation_common_string sequence_string = self.TRADE_MODEL_RULE_SIMULATION_SEQUENCE_STRING
sequence_string += """ sequence_string += """
ConfirmOrder ConfirmOrder
Tic Tic
""" + self.aggregated_amount_simulation_check + """ """ + self.AGGREGATED_AMOUNT_SIMULATION_CHECK_SEQUENCE_STRING + """
GetPackingList GetPackingList
PackPackingList PackPackingList
Tic Tic
""" + self.aggregated_amount_simulation_check + """ """ + self.AGGREGATED_AMOUNT_SIMULATION_CHECK_SEQUENCE_STRING + """
StartPackingList StartPackingList
StopPackingList StopPackingList
DeliverPackingList DeliverPackingList
Tic Tic
""" + self.aggregated_amount_simulation_check + """ """ + self.AGGREGATED_AMOUNT_SIMULATION_CHECK_SEQUENCE_STRING + """
GetInvoice GetInvoice
CheckInvoiceCausalityStateSolved CheckInvoiceCausalityStateSolved
CheckInvoiceNormalMovements CheckInvoiceNormalMovements
...@@ -1840,31 +1840,28 @@ class TestBPMTestCases(TestBPMMixin): ...@@ -1840,31 +1840,28 @@ class TestBPMTestCases(TestBPMMixin):
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self) sequence_list.play(self)
def test_TradeModelRuleSimulationPackingListSplitBuildInvoiceBuild(self): PACKING_LIST_SPLIT_INVOICE_BUILD_SEQUENCE_STRING = \
"""Check building invoice after splitting packing list""" TRADE_MODEL_RULE_SIMULATION_SEQUENCE_STRING + """
sequence_list = SequenceList()
sequence_string = self.trade_model_rule_simulation_common_string
sequence_string += """
ConfirmOrder ConfirmOrder
Tic Tic
""" + self.aggregated_amount_simulation_check + """ """ + AGGREGATED_AMOUNT_SIMULATION_CHECK_SEQUENCE_STRING + """
GetPackingList GetPackingList
DecreasePackingListLineListQuantity DecreasePackingListLineListQuantity
Tic Tic
""" + self.aggregated_amount_simulation_check + """ """ + AGGREGATED_AMOUNT_SIMULATION_CHECK_SEQUENCE_STRING + """
CheckPackingListDiverged CheckPackingListDiverged
SplitAndDeferPackingList SplitAndDeferPackingList
Tic Tic
""" + self.aggregated_amount_simulation_check + """ """ + AGGREGATED_AMOUNT_SIMULATION_CHECK_SEQUENCE_STRING + """
GetNewPackingList GetNewPackingList
PackPackingList PackPackingList
Tic Tic
""" + self.aggregated_amount_simulation_check + """ """ + AGGREGATED_AMOUNT_SIMULATION_CHECK_SEQUENCE_STRING + """
StartPackingList StartPackingList
StopPackingList StopPackingList
DeliverPackingList DeliverPackingList
Tic Tic
""" + self.aggregated_amount_simulation_check + """ """ + AGGREGATED_AMOUNT_SIMULATION_CHECK_SEQUENCE_STRING + """
GetInvoice GetInvoice
CheckInvoiceCausalityStateSolved CheckInvoiceCausalityStateSolved
CheckInvoiceNormalMovements CheckInvoiceNormalMovements
...@@ -1874,17 +1871,30 @@ class TestBPMTestCases(TestBPMMixin): ...@@ -1874,17 +1871,30 @@ class TestBPMTestCases(TestBPMMixin):
PackPackingList PackPackingList
Tic Tic
StartPackingList StartPackingList
""" + self.aggregated_amount_simulation_check + """ """ + AGGREGATED_AMOUNT_SIMULATION_CHECK_SEQUENCE_STRING + """
StopPackingList StopPackingList
DeliverPackingList DeliverPackingList
Tic Tic
""" + self.aggregated_amount_simulation_check + """ """ + AGGREGATED_AMOUNT_SIMULATION_CHECK_SEQUENCE_STRING + """
GetInvoice GetInvoice
CheckInvoiceCausalityStateSolved CheckInvoiceCausalityStateSolved
CheckInvoiceNormalMovements CheckInvoiceNormalMovements
CheckInvoiceTradeModelRelatedMovements CheckInvoiceTradeModelRelatedMovements
""" """
sequence_list.addSequenceString(sequence_string)
def test_TradeModelRuleSimulationPackingListSplitBuildInvoiceBuildDifferentRatio(self):
"""Check building invoice after splitting packing list using different ratio"""
self.modified_packing_list_line_quantity_ratio = 0.4
sequence_list = SequenceList()
sequence_list.addSequenceString(
self.PACKING_LIST_SPLIT_INVOICE_BUILD_SEQUENCE_STRING)
sequence_list.play(self)
def test_TradeModelRuleSimulationPackingListSplitBuildInvoiceBuild(self):
"""Check building invoice after splitting packing list"""
sequence_list = SequenceList()
sequence_list.addSequenceString(
self.PACKING_LIST_SPLIT_INVOICE_BUILD_SEQUENCE_STRING)
sequence_list.play(self) sequence_list.play(self)
class TestBPMSale(TestBPMTestCases): class TestBPMSale(TestBPMTestCases):
......
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