Commit 64b61d7a authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_accounting: Define appropriate Start Data on Movements

parent a63fc26f
......@@ -10,7 +10,10 @@ if context.getSimulationState() == 'confirmed' \
portal.portal_preferences.getPreferredAggregatedSubscriptionSaleTradeCondition()]:
comment = 'Start by alarm as all actions in confirmed state are ready.'
date = DateTime().earliestTime()
date = context.getStartDate()
if date is None:
date = DateTime().earliestTime()
context.edit(start_date=date, stop_date=date)
if isTransitionPossible(context, 'start'):
context.start(comment=comment)
......@@ -61,8 +61,8 @@ for movement in movement_list:
destination_section=movement.getDestination(),
destination_decision=movement.getDestination(),
specialise=specialise,
price_currency=movement.getPriceCurrency()
)
price_currency=movement.getPriceCurrency(),
start_date=movement.getStartDate())
# XXX Shamefully hardcoded values
if movement.getResource() == 'service_module/slapos_instance_subscription':
......@@ -84,8 +84,7 @@ for movement in movement_list:
if subscription is not None:
temp_movement.edit(
specialise=specialise_to_set,
causality=subscription,
start_date=movement.getStartDate())
causality=subscription)
elif movement.getCausality(portal_type="Subscription Request") is not None:
temp_movement.edit(
specialise=specialise_to_set,
......
......@@ -13,7 +13,8 @@ def newPackingList(movement, causality, message):
destination_decision=movement.getDestination(),
specialise=movement.getSpecialise(),
price_currency=movement.getPriceCurrency(),
causality=causality)
causality=causality,
start_date=movement.getStartDate())
delivery.confirm(message)
return delivery
......@@ -51,6 +52,9 @@ for movement in movement_list:
if delivery is not None and delivery.getSource() != movement.getSource():
delivery.setSource(movement.getSource())
if delivery is not None and delivery.getSourceSection() != movement.getSourceSection():
delivery.setSourceSection(movement.getSourceSection())
person_delivery_mapping["%s---%s---%s" % (person.getUid(), causality, specialise_uid)] = delivery
return person_delivery_mapping.values()
......@@ -1101,7 +1101,7 @@ class TestSlapOSStartConfirmedAggregatedSalePackingListAlarm(
False, delivery_date=DateTime("2012/04/22"),
accounting_date=DateTime('2012/04/23'))
def test_start_date_is_resetted(self):
def test_start_date_isnt_resetted(self):
delivery = self.portal.sale_packing_list_module.newContent(
portal_type="Sale Packing List",
start_date=DateTime("2012/04/22"),
......@@ -1122,9 +1122,9 @@ class TestSlapOSStartConfirmedAggregatedSalePackingListAlarm(
self.portal.portal_workflow._jumpToStateFor(delivery, 'solved')
self.portal.portal_workflow._jumpToStateFor(delivery, 'confirmed')
delivery.Delivery_startConfirmedAggregatedSalePackingList()
self.assertEqual(delivery.getStartDate(),
self.assertNotEqual(delivery.getStartDate(),
DateTime().earliestTime())
self.assertEqual(delivery.getStopDate(),
self.assertNotEqual(delivery.getStopDate(),
DateTime().earliestTime())
self.assertEqual(delivery.getSimulationState(), 'started')
......
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