Commit 3a525429 authored by Aurelien Campeas's avatar Aurelien Campeas
Browse files

[hooks] say which are the states

branch : stable
parent b9d3f7f884ce
......@@ -66,6 +66,7 @@ class State(AnyEntity):
rest_attr = 'eid'
def transitions(self, entity, desteid=None):
"""generates transition that MAY be passed"""
rql = ('Any T,N,DS where S allowed_transition T, S eid %(x)s, '
'T name N, T destination_state DS, '
'T transition_of ET, ET name %(et)s')
......@@ -438,7 +438,9 @@ def before_add_in_state(session, fromeid, rtype, toeid):
isrset = session.unsafe_execute('Any S WHERE ET initial_state S, ET name %(etype)s',
{'etype': etype})
if isrset and not toeid == isrset[0][0]:
msg = session._('not the initial state for this entity')
_ = session._
msg = _('%s is not the initial state (%s) for this entity') % (
_(session.entity_from_eid(toeid).name), _(isrset.get_entity(0,0).name))
raise ValidationError(fromeid, {'in_state': msg})
eschema = session.repo.schema[etype]
if not 'wf_info_for' in eschema.object_relations():
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment