Commit ff877187 authored by Romain Courteaud's avatar Romain Courteaud

slapos_accounting: checkConsistency after the source_payment is set

parent 7b3efb22
......@@ -8,7 +8,6 @@ now = DateTime()
isTransitionPossible = portal.portal_workflow.isTransitionPossible
if (context.getSimulationState() == 'confirmed')\
and (context.getLedger() == 'automated')\
and (len(context.checkConsistency()) == 0)\
and (context.getCausalityState() == 'solved')\
and (0 < len(context.objectValues(portal_type="Sale Invoice Transaction Line"))\
and (context.getStopDate(now) < now)):
......@@ -16,8 +15,9 @@ if (context.getSimulationState() == 'confirmed')\
if context.getSourcePayment("") == "":
context.setSourcePayment(context.AccountingTransaction_getSourcePaymentItemList()[-1][1])
comment = 'Stopped by alarm as all actions in confirmed state are ready.'
if isTransitionPossible(context, 'start'):
context.start(comment=comment)
if isTransitionPossible(context, 'stop'):
context.stop(comment=comment)
if (len(context.checkConsistency()) == 0):
comment = 'Stopped by alarm as all actions in confirmed state are ready.'
if isTransitionPossible(context, 'start'):
context.start(comment=comment)
if isTransitionPossible(context, 'stop'):
context.stop(comment=comment)
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