equal
deleted
inserted
replaced
170 if not deststateeid: |
170 if not deststateeid: |
171 msg = session._('mandatory relation') |
171 msg = session._('mandatory relation') |
172 raise ValidationError(entity.eid, {'by_transition': msg}) |
172 raise ValidationError(entity.eid, {'by_transition': msg}) |
173 deststate = wf.state_by_eid(deststateeid) |
173 deststate = wf.state_by_eid(deststateeid) |
174 if not cowpowers and deststate is None: |
174 if not cowpowers and deststate is None: |
175 msg = entity.req._("state doesn't belong to entity's workflow") |
175 msg = session._("state doesn't belong to entity's workflow") |
176 raise ValidationError(entity.eid, {'to_state': msg}) |
176 raise ValidationError(entity.eid, {'to_state': msg}) |
177 else: |
177 else: |
178 # check transition is valid and allowed, unless we're coming back from |
178 # check transition is valid and allowed, unless we're coming back from |
179 # subworkflow |
179 # subworkflow |
180 tr = session.entity_from_eid(treid) |
180 tr = session.entity_from_eid(treid) |
194 msg = session._("transition isn't allowed") |
194 msg = session._("transition isn't allowed") |
195 raise ValidationError(entity.eid, {'by_transition': msg}) |
195 raise ValidationError(entity.eid, {'by_transition': msg}) |
196 if swtr is None: |
196 if swtr is None: |
197 deststate = session.entity_from_eid(deststateeid) |
197 deststate = session.entity_from_eid(deststateeid) |
198 if not cowpowers and deststate is None: |
198 if not cowpowers and deststate is None: |
199 msg = entity.req._("state doesn't belong to entity's workflow") |
199 msg = session._("state doesn't belong to entity's workflow") |
200 raise ValidationError(entity.eid, {'to_state': msg}) |
200 raise ValidationError(entity.eid, {'to_state': msg}) |
201 else: |
201 else: |
202 deststateeid = tr.destination().eid |
202 deststateeid = tr.destination().eid |
203 # everything is ok, add missing information on the trinfo entity |
203 # everything is ok, add missing information on the trinfo entity |
204 entity['from_state'] = fromstate.eid |
204 entity['from_state'] = fromstate.eid |
224 if forentity.main_workflow.eid != forentity.current_workflow.eid: |
224 if forentity.main_workflow.eid != forentity.current_workflow.eid: |
225 # we're in a subworkflow, check if we've reached an exit point |
225 # we're in a subworkflow, check if we've reached an exit point |
226 wftr = forentity.subworkflow_input_transition() |
226 wftr = forentity.subworkflow_input_transition() |
227 if wftr is None: |
227 if wftr is None: |
228 # inconsistency detected |
228 # inconsistency detected |
229 msg = entity.req._("state doesn't belong to entity's current workflow") |
229 msg = session._("state doesn't belong to entity's current workflow") |
230 raise ValidationError(entity.eid, {'to_state': msg}) |
230 raise ValidationError(entity.eid, {'to_state': msg}) |
231 tostate = wftr.get_exit_point(entity['to_state']) |
231 tostate = wftr.get_exit_point(entity['to_state']) |
232 if tostate is not None: |
232 if tostate is not None: |
233 # reached an exit point |
233 # reached an exit point |
234 msg = session._('exiting from subworkflow %s') |
234 msg = session._('exiting from subworkflow %s') |