Changed header to remove link to "new version" when the only content version is in "retired" state
--- a/src/pyams_content/shared/common/zmi/header.py Wed Jul 12 11:46:22 2017 +0200
+++ b/src/pyams_content/shared/common/zmi/header.py Wed Jul 12 11:48:01 2017 +0200
@@ -111,11 +111,14 @@
(state.state in workflow.retired_states and has_update_state):
target = sorted(versions.get_versions(workflow.update_states),
key=lambda x: IWorkflowState(x).version_id)[-1]
- self.version_link = {
- 'css_class': 'text-danger',
- 'href': absolute_url(target, request, 'admin'),
- 'title': translate(_("access new version"))
- }
+ if target is not context:
+ self.version_link = {
+ 'css_class': 'text-danger',
+ 'href': absolute_url(target, request, 'admin'),
+ 'title': translate(_("access new version"))
+ }
+ else:
+ self.version_link = None
elif state.state not in workflow.published_states and versions.has_version(workflow.published_states):
target = sorted(versions.get_versions(workflow.published_states),
key=lambda x: IWorkflowState(x).version_id,