hooks/workflow.py
changeset 3890 d7a270f50f54
parent 3777 3ef8cdb5fb1c
child 3894 27cbf98ad863
equal deleted inserted replaced
3810:5b75fd66c80e 3890:d7a270f50f54
   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})
   226                 if not tr.has_input_state(fromstate):
   226                 if not tr.has_input_state(fromstate):
   227                     msg = session._("transition isn't allowed")
   227                     msg = session._("transition %s isn't allowed from %s") % (
       
   228                         _(tr.name), _(fromstate.name))
   228                     raise ValidationError(entity.eid, {'by_transition': msg})
   229                     raise ValidationError(entity.eid, {'by_transition': msg})
   229                 if not tr.may_be_fired(foreid):
   230                  if not tr.may_be_fired(foreid):
   230                     msg = session._("transition may not be fired")
   231                     msg = session._("transition may not be fired")
   231                     raise ValidationError(entity.eid, {'by_transition': msg})
   232                     raise ValidationError(entity.eid, {'by_transition': msg})
   232             if entity.get('to_state'):
   233             if entity.get('to_state'):
   233                 deststateeid = entity['to_state']
   234                 deststateeid = entity['to_state']
   234                 if not cowpowers and deststateeid != tr.destination().eid:
   235                 if not cowpowers and deststateeid != tr.destination().eid: