hooks/workflow.py
changeset 4181 c79135c217df
parent 4088 23ce2b3fb03d
child 4307 7fba9c34c88f
equal deleted inserted replaced
4173:cfd5d3270f99 4181:c79135c217df
   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 %s isn't allowed from %s") % (
   227                     msg = session._("transition %(tr)s isn't allowed from %(st)s") % {
   228                         _(tr.name), _(fromstate.name))
   228                         'tr': session._(tr.name), 'st': session._(fromstate.name)}
   229                     raise ValidationError(entity.eid, {'by_transition': msg})
   229                     raise ValidationError(entity.eid, {'by_transition': msg})
   230                 if not tr.may_be_fired(foreid):
   230                 if not tr.may_be_fired(foreid):
   231                     msg = session._("transition may not be fired")
   231                     msg = session._("transition may not be fired")
   232                     raise ValidationError(entity.eid, {'by_transition': msg})
   232                     raise ValidationError(entity.eid, {'by_transition': msg})
   233             if entity.get('to_state'):
   233             if entity.get('to_state'):