Commit ab138eda 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 067c0c7e b9bbb41d
......@@ -76,6 +76,8 @@ from django.http import HttpResponse
from xhtml2pdf import pisa
from app.helper.decorators import *
from app.applicationlayer.utils import error_message
config = configparser.ConfigParser()
config_file = os.path.join('./', 'env.ini')
......@@ -880,6 +882,13 @@ class ChangeRequestFormsViewset(viewsets.ModelViewSet):
form_code = kwargs['form_code']
form_data = request.data
# Restrict a requestor to submit a CR without atleast 1 approver
counter = change_request_template.validation_existing_approver(
form_data['frm_approvers'])
if counter == 0:
return error_message('400', 'Please select at least 1 approver before submitting this request.',
'failed', status.HTTP_400_BAD_REQUEST)
# generate batchno history
batchno = get_max_batchno("batch")
......
# Generated by Django 2.2 on 2020-02-05 17:07
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('entities', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='changerequestformattachments',
name='file_upload',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.PROTECT, related_name='form_attachments', to='entities.MasterAttachment'),
preserve_default=False,
),
migrations.AlterField(
model_name='changerequesttemplateattachments',
name='file_upload',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.PROTECT, related_name='template_attachments', to='entities.MasterAttachment'),
preserve_default=False,
),
]
......@@ -707,9 +707,7 @@ class ChangeRequestTemplateAttachments(BaseAttachment):
file_upload = models.ForeignKey(
MasterAttachment,
on_delete=models.PROTECT,
related_name='template_attachments',
blank=True,
null=True
related_name='template_attachments'
)
template_no = models.ForeignKey(
ChangeRequestTemplateHeader,
......@@ -936,9 +934,7 @@ class ChangeRequestFormAttachments(BaseAttachment):
file_upload = models.ForeignKey(
MasterAttachment,
on_delete=models.PROTECT,
related_name='form_attachments',
blank=True,
null=True
related_name='form_attachments'
)
class Meta:
......
......@@ -358,7 +358,7 @@ def FormValidation(function):
@wraps(function)
def wrapper(self, request, *args, **kwargs):
form_header = request.data
required = {'requested_to_template_name': 'CR Name',
'requested_to_target_date': 'Date Required',
'requested_to_company': 'Company',
......@@ -397,7 +397,7 @@ def FormValidation(function):
if validation_result is not None:
return error_message('400', validation_result + ' is already exist for the same level of approval.',
'failed', status.HTTP_400_BAD_REQUEST)
# Restrict a requestor to submit a CR without atleast 1 approver
counter = validation_existing_approver(frm_approvers)
if form_header['status'].lower() == 'pending' and counter == 0:
......
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