fix wf related actions stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 02 Sep 2009 10:20:12 +0200
branchstable
changeset 3082 99ab33abf414
parent 3081 f7e41995a18b
child 3084 096d680c9da2
fix wf related actions
web/views/boxes.py
--- a/web/views/boxes.py	Wed Sep 02 09:17:23 2009 +0200
+++ b/web/views/boxes.py	Wed Sep 02 10:20:12 2009 +0200
@@ -150,10 +150,13 @@
             for tr in state.transitions(entity):
                 url = entity.absolute_url(vid='statuschange', treid=tr.eid)
                 menu_items.append(self.mk_action(_(tr.name), url))
-            wfurl = self.build_url('cwetype/%s'%entity.e_schema, vid='workflow')
-            menu_items.append(self.mk_action(_('view workflow'), wfurl))
-            wfurl = entity.absolute_url(vid='wfhistory')
-            menu_items.append(self.mk_action(_('view history'), wfurl))
+            # don't propose to see wf if user can't pass any transition
+            if menu_items:
+                wfurl = self.build_url('cwetype/%s'%entity.e_schema, vid='workflow')
+                menu_items.append(self.mk_action(_('view workflow'), wfurl))
+            if len(entity.reverse_wf_info_for) > 1: # first item is not a transition
+                wfurl = entity.absolute_url(vid='wfhistory')
+                menu_items.append(self.mk_action(_('view history'), wfurl))
             box.append(BoxMenu(menu_title, menu_items))
         return None