Commit 67bccd94 authored by Julien Muchembled's avatar Julien Muchembled

testTradeModelLine: simplify code triggering builders

parent 35be87ce
...@@ -344,7 +344,7 @@ class TestTradeModelLine(TestTradeModelLineMixin): ...@@ -344,7 +344,7 @@ class TestTradeModelLine(TestTradeModelLineMixin):
packing_list.stop() packing_list.stop()
transaction.commit() transaction.commit()
self.tic() self.tic()
self.stepInvoiceBuilderAlarm() self.buildInvoices()
transaction.commit() transaction.commit()
self.tic() self.tic()
...@@ -478,21 +478,15 @@ class TestTradeModelLine(TestTradeModelLineMixin): ...@@ -478,21 +478,15 @@ class TestTradeModelLine(TestTradeModelLineMixin):
self.assertEquals(str(abs(line_dict['income_expense'])), self.assertEquals(str(abs(line_dict['income_expense'])),
str(rounded_total_price + rounded_discount_price)) str(rounded_total_price + rounded_discount_price))
def stepPackingListBuilderAlarm(self, sequence=None, def buildPackingLists(self):
sequence_list=None, **kw): self.portal.portal_alarms.packing_list_builder_alarm.activeSense()
# global builder alarm does not exist in legacy simulation transaction.commit()
# business templates. self.tic()
alarm = getattr(self.portal.portal_alarms, 'packing_list_builder_alarm', None)
if alarm is not None: def buildInvoices(self):
alarm.activeSense() self.portal.portal_alarms.invoice_builder_alarm.activeSense()
transaction.commit()
def stepInvoiceBuilderAlarm(self, sequence=None, self.tic()
sequence_list=None, **kw):
# global builder alarm does not exist in legacy simulation
# business templates.
alarm = getattr(self.portal.portal_alarms, 'invoice_builder_alarm', None)
if alarm is not None:
alarm.activeSense()
### ###
## Test cases ## Test cases
...@@ -606,9 +600,7 @@ class TestTradeModelLine(TestTradeModelLineMixin): ...@@ -606,9 +600,7 @@ class TestTradeModelLine(TestTradeModelLineMixin):
order.confirm() order.confirm()
transaction.commit() transaction.commit()
self.tic() self.tic()
self.stepPackingListBuilderAlarm() self.buildPackingLists()
transaction.commit()
self.tic()
packing_list, = order.getCausalityRelatedValueList( packing_list, = order.getCausalityRelatedValueList(
portal_type=self.packing_list_portal_type) portal_type=self.packing_list_portal_type)
...@@ -937,9 +929,7 @@ return lambda *args, **kw: 1""") ...@@ -937,9 +929,7 @@ return lambda *args, **kw: 1""")
order.confirm() order.confirm()
transaction.commit() transaction.commit()
self.tic() self.tic()
self.stepPackingListBuilderAlarm() self.buildPackingLists()
transaction.commit()
self.tic()
packing_list = order.getCausalityRelatedValue( packing_list = order.getCausalityRelatedValue(
portal_type=self.packing_list_portal_type) portal_type=self.packing_list_portal_type)
...@@ -951,9 +941,7 @@ return lambda *args, **kw: 1""") ...@@ -951,9 +941,7 @@ return lambda *args, **kw: 1""")
packing_list.deliver() packing_list.deliver()
transaction.commit() transaction.commit()
self.tic() self.tic()
self.stepInvoiceBuilderAlarm() self.buildInvoices()
transaction.commit()
self.tic()
invoice = packing_list.getCausalityRelatedValue( invoice = packing_list.getCausalityRelatedValue(
portal_type=self.invoice_portal_type) portal_type=self.invoice_portal_type)
......
...@@ -52,6 +52,9 @@ for name in list(TestTradeModelLine.__dict__): ...@@ -52,6 +52,9 @@ for name in list(TestTradeModelLine.__dict__):
if '_NewSimulation_' in name: if '_NewSimulation_' in name:
delattr(TestTradeModelLine, name) delattr(TestTradeModelLine, name)
TestTradeModelLine.buildInvoices = TestTradeModelLine.buildPackingLists = \
lambda self: None
def createBusinessProcess(self, *args, **kw): def createBusinessProcess(self, *args, **kw):
business_process = super(TestTradeModelLine, self) \ business_process = super(TestTradeModelLine, self) \
.createBusinessProcess(*args, **kw) .createBusinessProcess(*args, **kw)
......
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