server/hooks.py
branchstable
changeset 2908 1c42a9826dd4
parent 2745 0dafa29ace1f
child 2909 e695b7b0359d
equal deleted inserted replaced
2904:b9d3f7f884ce 2908:1c42a9826dd4
   436             # not a transition
   436             # not a transition
   437             # check state is initial state if the workflow defines one
   437             # check state is initial state if the workflow defines one
   438             isrset = session.unsafe_execute('Any S WHERE ET initial_state S, ET name %(etype)s',
   438             isrset = session.unsafe_execute('Any S WHERE ET initial_state S, ET name %(etype)s',
   439                                             {'etype': etype})
   439                                             {'etype': etype})
   440             if isrset and not toeid == isrset[0][0]:
   440             if isrset and not toeid == isrset[0][0]:
   441                 msg = session._('not the initial state for this entity')
   441                 _ = session._
       
   442                 msg = _('%s is not the initial state (%s) for this entity') % (
       
   443                     _(session.entity_from_eid(toeid).name), _(isrset.get_entity(0,0).name))
   442                 raise ValidationError(fromeid, {'in_state': msg})
   444                 raise ValidationError(fromeid, {'in_state': msg})
   443     eschema = session.repo.schema[etype]
   445     eschema = session.repo.schema[etype]
   444     if not 'wf_info_for' in eschema.object_relations():
   446     if not 'wf_info_for' in eschema.object_relations():
   445         # workflow history not activated for this entity type
   447         # workflow history not activated for this entity type
   446         return
   448         return