Commit ed0e099a authored by Romain Courteaud's avatar Romain Courteaud

slapos_panel: only show action if the project is validated

parent 756dec5d
portal = context.getPortalObject() portal = context.getPortalObject()
if project_relation == 'context': if project_relation == 'context':
project_reference = context.getReference() project = context
elif project_relation == 'follow_up': elif project_relation == 'follow_up':
project_reference = context.getFollowUpReference() project = context.getFollowUpValue()
elif project_relation == 'destination_project': elif project_relation == 'destination_project':
project_reference = context.getDestinationProjectReference() project = context.getDestinationProjectValue()
else: else:
raise ValueError('Unexpected project relation: %s' % project_relation) raise ValueError('Unexpected project relation: %s' % project_relation)
project_reference = project.getReference()
member = portal.portal_membership.getAuthenticatedMember() member = portal.portal_membership.getAuthenticatedMember()
getGroups = getattr(member, 'getGroups', None) getGroups = getattr(member, 'getGroups', None)
if getGroups is not None: if getGroups is not None:
user_group_list = getGroups() user_group_list = getGroups()
return ( return (project.getValidationState() == 'validated') and (
((manager) and ('%s_F-PRODMAN' % project_reference in user_group_list)) or ((manager) and ('%s_F-PRODMAN' % project_reference in user_group_list)) or
((agent) and ('%s_F-PRODAGNT' % project_reference in user_group_list)) or ((agent) and ('%s_F-PRODAGNT' % project_reference in user_group_list)) or
((customer) and ('%s_F-CUSTOMER' % project_reference in user_group_list)) ((customer) and ('%s_F-CUSTOMER' % project_reference in user_group_list))
......
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