equal
deleted
inserted
replaced
200 cowpowers = session.is_super_session or 'managers' in session.user.groups |
200 cowpowers = session.is_super_session or 'managers' in session.user.groups |
201 # no investigate the requested state change... |
201 # no investigate the requested state change... |
202 try: |
202 try: |
203 treid = entity['by_transition'] |
203 treid = entity['by_transition'] |
204 except KeyError: |
204 except KeyError: |
205 # no transition set, check user is a manager and destination state is |
205 # no transition set, check user is a manager and destination state |
206 # specified (and valid) |
206 # is specified (and valid) |
207 if not cowpowers: |
207 if not cowpowers: |
208 msg = session._('mandatory relation') |
208 msg = session._('mandatory relation') |
209 raise ValidationError(entity.eid, {'by_transition': msg}) |
209 raise ValidationError(entity.eid, {'by_transition': msg}) |
210 deststateeid = entity.get('to_state') |
210 deststateeid = entity.get('to_state') |
211 if not deststateeid: |
211 if not deststateeid: |
214 deststate = wf.state_by_eid(deststateeid) |
214 deststate = wf.state_by_eid(deststateeid) |
215 if deststate is None: |
215 if deststate is None: |
216 msg = session._("state doesn't belong to entity's workflow") |
216 msg = session._("state doesn't belong to entity's workflow") |
217 raise ValidationError(entity.eid, {'to_state': msg}) |
217 raise ValidationError(entity.eid, {'to_state': msg}) |
218 else: |
218 else: |
219 # check transition is valid and allowed, unless we're coming back from |
219 # check transition is valid and allowed, unless we're coming back |
220 # subworkflow |
220 # from subworkflow |
221 tr = session.entity_from_eid(treid) |
221 tr = session.entity_from_eid(treid) |
222 if swtr is None: |
222 if swtr is None: |
223 if tr is None: |
223 if tr is None: |
224 msg = session._("transition doesn't belong to entity's workflow") |
224 msg = session._("transition doesn't belong to entity's workflow") |
225 raise ValidationError(entity.eid, {'by_transition': msg}) |
225 raise ValidationError(entity.eid, {'by_transition': msg}) |