web/views/boxes.py
branchstable
changeset 3082 99ab33abf414
parent 2650 18aec79ec3a3
child 3084 096d680c9da2
--- 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