Commit b8287547 authored by Romain Courteaud's avatar Romain Courteaud

WIP slapos_accounting: do not stop invoice until the stop date is passed

parent 9a0c0f08
portal = context.getPortalObject()
from DateTime import DateTime
if context.getPortalType() != 'Sale Invoice Transaction':
raise TypeError('Incorrect delivery.')
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 len(context.objectValues(portal_type="Sale Invoice Transaction Line")):
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)):
comment = 'Stopped by alarm as all actions in confirmed state are ready.'
if isTransitionPossible(context, 'start'):
......
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