Commit c2362fcf authored by John Red Medrano's avatar John Red Medrano

Merge branch 'RMSv2' of http://42.61.118.105:7990/scm/rms/api-main-service...

Merge branch 'RMSv2' of http://42.61.118.105:7990/scm/rms/api-main-service into core-dev-red-develop
parents 52435db6 f26b7a49
......@@ -752,7 +752,7 @@ class ChangeRequestFormsViewset(viewsets.ModelViewSet):
return Response(message, status=status.HTTP_200_OK)
@FormValidation
# @FormValidation
@transaction.atomic
@action(
methods=['PATCH'], detail=True,
......@@ -866,7 +866,7 @@ class ChangeRequestFormsViewset(viewsets.ModelViewSet):
return Response(message, status=status.HTTP_200_OK)
@FormValidation
# @FormValidation
@transaction.atomic
@action(
methods=['PATCH'], detail=True,
......
......@@ -188,7 +188,7 @@ class ChangeRequestTemplatesViewset(viewsets.ModelViewSet):
return Response(e,
status=status.HTTP_500_INTERNAL_SERVER_ERROR)
@TemplateValidation
# @TemplateValidation
@transaction.atomic
def partial_update(self, request, *args, **kwargs):
......
......@@ -175,17 +175,18 @@ def validation_poc_vendor_only(poc, approvers):
# Check if level if Vendor delegation has same level with other delegation
def validation_vendor_unique_level(approvers):
validate = False
validate = 0
data_level = []
for approver in approvers:
if 'delegation' in approver:
if approver['delegation'] == 'DELEGATION-20191119-0000002':
data_level.append(approver['level'])
for approver in approvers:
if 'delegation' in approver:
if approver['level'] in data_level:
if not approver['delegation'] == 'DELEGATION-20191119-0000002':
validate = True
return validate
\ No newline at end of file
if (not approver['delegation'] == 'DELEGATION-20191119-0000002'
and not approver['delegation'] == ''):
validate = approver['level']
return validate
......@@ -307,7 +307,8 @@ def TemplateValidation(function):
'requested_to_department': 'Department'}
for key in required.keys():
if not key in template_header or template_header[key].strip() == '':
if (not key in template_header or
str(template_header[key]).strip() == ''):
return error_message('400', required[key] + ' is required',
'failed', status.HTTP_400_BAD_REQUEST)
......@@ -353,8 +354,8 @@ def TemplateValidation(function):
# Do not allow to save Vendor same level to other delegation
validate = validation_vendor_unique_level(tmp_approvers)
if validate is True:
return error_message('400', 'Vendor/Implementor cannot have same level with other delegation/s',
if not validate == 0:
return error_message('400', 'Level ' + str(validate) + ' is already assigned for the Vendor/Implementor.',
'failed', status.HTTP_400_BAD_REQUEST)
return function(self, request, *args, **kwargs)
......@@ -374,7 +375,7 @@ def FormValidation(function):
'requested_to_priority': 'Priority Level'}
for key in required.keys():
if not key in form_header or form_header[key].strip() == '':
if not key in form_header or str(form_header[key]).strip() == '':
return error_message('400', required[key] + ' is required',
'failed', status.HTTP_400_BAD_REQUEST)
......@@ -423,6 +424,6 @@ def FormValidation(function):
if validate is True:
return error_message('400', 'Vendor/Implementor cannot have same level with other delegation/s',
'failed', status.HTTP_400_BAD_REQUEST)
return function(self, request, *args, **kwargs)
return wrapper
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