Commit 8024224f authored by Romain Courteaud's avatar Romain Courteaud

slapos_accounting: checkConsistency after the source_payment is set

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