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

- check that references are properly set on generated movements

 - set reference for model lines, as this is used in shadowing models contained in specialised chain of objects


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27420 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 07ee1d9e
...@@ -1291,6 +1291,7 @@ class TestBPMMixin(ERP5TypeTestCase): ...@@ -1291,6 +1291,7 @@ class TestBPMMixin(ERP5TypeTestCase):
def stepCheckOrderLineTaxedAggregatedAmountList(self, sequence=None, **kw): def stepCheckOrderLineTaxedAggregatedAmountList(self, sequence=None, **kw):
order_line = sequence.get('order_line_taxed') order_line = sequence.get('order_line_taxed')
trade_condition = sequence.get('trade_condition') trade_condition = sequence.get('trade_condition')
trade_model_line_tax = sequence.get('trade_model_line_tax')
amount_list = trade_condition.getAggregatedAmountList(order_line) amount_list = trade_condition.getAggregatedAmountList(order_line)
self.assertEquals(1, len(amount_list)) self.assertEquals(1, len(amount_list))
...@@ -1300,6 +1301,8 @@ class TestBPMMixin(ERP5TypeTestCase): ...@@ -1300,6 +1301,8 @@ class TestBPMMixin(ERP5TypeTestCase):
tax_amount = tax_amount_list[0] tax_amount = tax_amount_list[0]
self.assertEqual(tax_amount.getReference(),
trade_model_line_tax.getReference())
self.assertSameSet(['base_amount/tax'], self.assertSameSet(['base_amount/tax'],
tax_amount.getBaseApplicationList()) tax_amount.getBaseApplicationList())
self.assertSameSet([], tax_amount.getBaseContributionList()) self.assertSameSet([], tax_amount.getBaseContributionList())
...@@ -1311,6 +1314,8 @@ class TestBPMMixin(ERP5TypeTestCase): ...@@ -1311,6 +1314,8 @@ class TestBPMMixin(ERP5TypeTestCase):
sequence=None, **kw): sequence=None, **kw):
order_line = sequence.get('order_line_discounted_taxed') order_line = sequence.get('order_line_discounted_taxed')
trade_condition = sequence.get('trade_condition') trade_condition = sequence.get('trade_condition')
trade_model_line_discount = sequence.get('trade_model_line_discount')
trade_model_line_tax = sequence.get('trade_model_line_tax')
amount_list = trade_condition.getAggregatedAmountList(order_line) amount_list = trade_condition.getAggregatedAmountList(order_line)
self.assertEquals(2, len(amount_list)) self.assertEquals(2, len(amount_list))
...@@ -1325,10 +1330,14 @@ class TestBPMMixin(ERP5TypeTestCase): ...@@ -1325,10 +1330,14 @@ class TestBPMMixin(ERP5TypeTestCase):
discount_amount = discount_amount_list[0] discount_amount = discount_amount_list[0]
self.assertEqual(tax_amount.getReference(),
trade_model_line_tax.getReference())
self.assertSameSet(['base_amount/tax'], tax_amount. \ self.assertSameSet(['base_amount/tax'], tax_amount. \
getBaseApplicationList()) getBaseApplicationList())
self.assertSameSet([], tax_amount.getBaseContributionList()) self.assertSameSet([], tax_amount.getBaseContributionList())
self.assertEqual(discount_amount.getReference(),
trade_model_line_discount.getReference())
self.assertSameSet(['base_amount/discount'], discount_amount. \ self.assertSameSet(['base_amount/discount'], discount_amount. \
getBaseApplicationList()) getBaseApplicationList())
self.assertSameSet(['base_amount/tax'], discount_amount. \ self.assertSameSet(['base_amount/tax'], discount_amount. \
...@@ -1345,6 +1354,7 @@ class TestBPMMixin(ERP5TypeTestCase): ...@@ -1345,6 +1354,7 @@ class TestBPMMixin(ERP5TypeTestCase):
**kw): **kw):
order_line = sequence.get('order_line_discounted') order_line = sequence.get('order_line_discounted')
trade_condition = sequence.get('trade_condition') trade_condition = sequence.get('trade_condition')
trade_model_line_discount = sequence.get('trade_model_line_discount')
amount_list = trade_condition.getAggregatedAmountList(order_line) amount_list = trade_condition.getAggregatedAmountList(order_line)
self.assertEquals(2, len(amount_list)) self.assertEquals(2, len(amount_list))
...@@ -1359,6 +1369,8 @@ class TestBPMMixin(ERP5TypeTestCase): ...@@ -1359,6 +1369,8 @@ class TestBPMMixin(ERP5TypeTestCase):
discount_amount = discount_amount_list[0] discount_amount = discount_amount_list[0]
self.assertEqual(discount_amount.getReference(),
trade_model_line_discount.getReference())
self.assertSameSet(['base_amount/tax'], tax_amount. \ self.assertSameSet(['base_amount/tax'], tax_amount. \
getBaseApplicationList()) getBaseApplicationList())
self.assertSameSet([], tax_amount.getBaseContributionList()) self.assertSameSet([], tax_amount.getBaseContributionList())
...@@ -1382,6 +1394,8 @@ class TestBPMMixin(ERP5TypeTestCase): ...@@ -1382,6 +1394,8 @@ class TestBPMMixin(ERP5TypeTestCase):
order_line_discounted = sequence.get('order_line_discounted') order_line_discounted = sequence.get('order_line_discounted')
order_line_discounted_taxed = sequence.get('order_line_discounted_taxed') order_line_discounted_taxed = sequence.get('order_line_discounted_taxed')
order_line_taxed = sequence.get('order_line_taxed') order_line_taxed = sequence.get('order_line_taxed')
trade_model_line_tax = sequence.get('trade_model_line_tax')
trade_model_line_discount = sequence.get('trade_model_line_discount')
amount_list = trade_condition.getAggregatedAmountList(order) amount_list = trade_condition.getAggregatedAmountList(order)
self.assertEquals(2, len(amount_list)) self.assertEquals(2, len(amount_list))
...@@ -1396,6 +1410,8 @@ class TestBPMMixin(ERP5TypeTestCase): ...@@ -1396,6 +1410,8 @@ class TestBPMMixin(ERP5TypeTestCase):
discount_amount = discount_amount_list[0] discount_amount = discount_amount_list[0]
tax_amount = tax_amount_list[0] tax_amount = tax_amount_list[0]
self.assertEqual(discount_amount.getReference(),
trade_model_line_discount.getReference())
self.assertSameSet(['base_amount/discount'], discount_amount. \ self.assertSameSet(['base_amount/discount'], discount_amount. \
getBaseApplicationList()) getBaseApplicationList())
...@@ -1406,6 +1422,8 @@ class TestBPMMixin(ERP5TypeTestCase): ...@@ -1406,6 +1422,8 @@ class TestBPMMixin(ERP5TypeTestCase):
getBaseApplicationList()) getBaseApplicationList())
self.assertSameSet([], tax_amount.getBaseContributionList()) self.assertSameSet([], tax_amount.getBaseContributionList())
self.assertEqual(tax_amount.getReference(),
trade_model_line_tax.getReference())
self.assertEqual( self.assertEqual(
discount_amount.getTotalPrice(), discount_amount.getTotalPrice(),
...@@ -1644,15 +1662,18 @@ class TestBPMTestCases(TestBPMMixin): ...@@ -1644,15 +1662,18 @@ class TestBPMTestCases(TestBPMMixin):
trade_condition_1_trade_model_line = self.createTradeModelLine( trade_condition_1_trade_model_line = self.createTradeModelLine(
trade_condition_1, trade_condition_1,
resource_value = service_1) resource_value = service_1,
reference = 'A')
trade_condition_2_trade_model_line = self.createTradeModelLine( trade_condition_2_trade_model_line = self.createTradeModelLine(
trade_condition_2, trade_condition_2,
resource_value = service_2) resource_value = service_2,
reference = 'B')
order_trade_model_line = self.createTradeModelLine( order_trade_model_line = self.createTradeModelLine(
order, order,
resource_value = service_2) resource_value = service_2,
reference = 'B')
self.assertSameSet( self.assertSameSet(
[trade_condition_1_trade_model_line, [trade_condition_1_trade_model_line,
...@@ -1679,11 +1700,13 @@ class TestBPMTestCases(TestBPMMixin): ...@@ -1679,11 +1700,13 @@ class TestBPMTestCases(TestBPMMixin):
trade_condition_1_trade_model_line = self.createTradeModelLine( trade_condition_1_trade_model_line = self.createTradeModelLine(
trade_condition_1, trade_condition_1,
resource_value = service) resource_value = service,
reference = 'A')
trade_condition_2_trade_model_line = self.createTradeModelLine( trade_condition_2_trade_model_line = self.createTradeModelLine(
trade_condition_2, trade_condition_2,
resource_value = service) resource_value = service,
reference = 'A')
self.assertSameSet( self.assertSameSet(
[trade_condition_1_trade_model_line], [trade_condition_1_trade_model_line],
......
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