web/views/boxes.py
branch3.5
changeset 3084 096d680c9da2
parent 2993 2d06451013ac
parent 3082 99ab33abf414
child 3219 be8cfc00ae04
--- a/web/views/boxes.py	Tue Sep 01 18:45:50 2009 +0200
+++ b/web/views/boxes.py	Wed Sep 02 10:23:38 2009 +0200
@@ -140,10 +140,13 @@
             for tr in entity.possible_transitions():
                 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 entity.workflow_history:
+                wfurl = entity.absolute_url(vid='wfhistory')
+                menu_items.append(self.mk_action(_('view history'), wfurl))
             box.append(BoxMenu(menu_title, menu_items))
         return None