Commit 5fb44c69 authored by Romain Courteaud's avatar Romain Courteaud 🐸

Change the aggregate packing list start date while delivering it.

It allows to have understandable accounting date on the invoice.
parent b1694904
......@@ -50,7 +50,8 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>portal = context.getPortalObject()\n
<value> <string>from DateTime import DateTime\n
portal = context.getPortalObject()\n
if context.getPortalType() != \'Sale Packing List\':\n
raise TypeError(\'Incorrect delivery.\')\n
isTransitionPossible = portal.portal_workflow.isTransitionPossible\n
......@@ -59,6 +60,7 @@ if context.getSimulationState() == \'confirmed\' \\\n
and context.getCausalityState() == \'solved\' \\\n
and context.getSpecialise() == portal.portal_preferences.getPreferredAggregatedSaleTradeCondition():\n
comment = \'Delivered by alarm as all actions in confirmed state are ready.\'\n
context.edit(start_date=DateTime().earliestTime())\n
if isTransitionPossible(context, \'start\'):\n
context.start(comment=comment)\n
if isTransitionPossible(context, \'stop\'):\n
......
......@@ -1667,6 +1667,32 @@ class TestSlapOSDeliverConfirmedAggregatedSalePackingListAlarm(
False, delivery_date=DateTime("2012/04/22"),
accounting_date=DateTime('2012/04/23'))
def test_start_date_is_resetted(self):
delivery = self.portal.sale_packing_list_module.newContent(
portal_type="Sale Packing List",
start_date=DateTime("2012/04/22"),
specialise='sale_trade_condition_module/slapos_aggregated_trade_condition',
source='organisation_module/slapos',
source_section='organisation_module/slapos',
destination='organisation_module/slapos',
destination_section='organisation_module/slapos',
destination_decision='organisation_module/slapos',
price_currency='currency_module/EUR',
)
movement = delivery.newContent(
portal_type="Sale Packing List Line",
resource='service_module/slapos_instance_setup',
quantity=0,
price=0,
)
self.portal.portal_workflow._jumpToStateFor(delivery, 'solved')
self.portal.portal_workflow._jumpToStateFor(delivery, 'confirmed')
delivery.Delivery_deliverConfirmedAggregatedSalePackingList()
self.assertEquals(delivery.getStartDate(),
DateTime().earliestTime())
self.assertEquals(delivery.getSimulationState(), 'delivered')
class TestSlapOSStopConfirmedAggregatedSaleInvoiceTransactionAlarm(
testSlapOSMixin, TestSlapOSConfirmedDeliveryMixin):
destination_state = 'stopped'
......
250
\ No newline at end of file
251
\ No newline at end of file
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