Commit ab4db43c authored by Yusei Tahara's avatar Yusei Tahara

Fix test_tradeModelLineWithTargetLevelSetting. Causality link is set only when...

Fix test_tradeModelLineWithTargetLevelSetting. Causality link is set only when trade model line is matched with movements by base contribution.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30951 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent cbedb10e
......@@ -34,6 +34,8 @@ from Products.ERP5.tests.testBPMCore import TestBPMMixin
from Products.ERP5Type.tests.Sequence import SequenceList
from DateTime import DateTime
from Products.CMFCore.utils import getToolByName
from Products.ERP5.PropertySheet.TradeModelLine import (TARGET_LEVEL_MOVEMENT,
TARGET_LEVEL_DELIVERY)
class TestTradeModelLineMixin(TestBPMMixin):
"""Provides methods to implementations sharing similar logic to Trade Model Lines"""
......@@ -2392,10 +2394,6 @@ class TestTradeModelLine(TestTradeModelLineMixin):
and trade model line can works with appropriate context(delivery or
movement) only.
"""
from Products.ERP5.PropertySheet.TradeModelLine import (
TARGET_LEVEL_MOVEMENT,
TARGET_LEVEL_DELIVERY)
trade_condition = self.createTradeCondition()
# create a model line and set target level to `delivery`.
tax = self.createTradeModelLine(trade_condition,
......@@ -2467,18 +2465,30 @@ class TestTradeModelLine(TestTradeModelLineMixin):
# Make sure that getAggregatedAmountList of movement uses movement
# level trade model line only.
def getMovementFromAmountListByReference(amount_list, reference):
for amount in amount_list:
if amount.getReference()==reference:
return amount
amount_list = trade_condition.getAggregatedAmountList(order_line_1)
self.assertEqual(2, len(amount_list))
extra_fee_a_amount = getMovementFromAmountListByReference(amount_list,
'EXTRA_FEE_A')
self.assertEqual([],
extra_fee_a_amount.getCausalityValueList())
tax_amount = getMovementFromAmountListByReference(amount_list,
'TAX')
self.assertEqual([order_line_1],
amount_list[0].getCausalityValueList())
self.assertEqual([order_line_1],
amount_list[1].getCausalityValueList())
tax_amount.getCausalityValueList())
amount_list = trade_condition.getAggregatedAmountList(order_line_2)
self.assertEqual(2, len(amount_list))
extra_fee_a_amount = getMovementFromAmountListByReference(amount_list,
'EXTRA_FEE_A')
self.assertEqual([],
extra_fee_a_amount.getCausalityValueList())
tax_amount = getMovementFromAmountListByReference(amount_list,
'TAX')
self.assertEqual([order_line_2],
amount_list[0].getCausalityValueList())
self.assertEqual([order_line_2],
amount_list[1].getCausalityValueList())
tax_amount.getCausalityValueList())
# Change target level
extra_fee.edit(target_level=TARGET_LEVEL_DELIVERY)
......
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