Commit 9505e38c authored by Gladys Forte's avatar Gladys Forte

try action rejected

parent 856ea16d
...@@ -190,7 +190,25 @@ class ChangeRequestFormsViewset(viewsets.ModelViewSet): ...@@ -190,7 +190,25 @@ class ChangeRequestFormsViewset(viewsets.ModelViewSet):
overdue_filtered = change_request.filter_overdue(self.queryset) overdue_filtered = change_request.filter_overdue(self.queryset)
overdue = overdue_filtered.count() overdue = overdue_filtered.count()
# to disable create cr and cr template in dashboard
can_create_cr = models.AllowedCompany.objects.filter(
id_number=id_number, create_change_request=1
)
can_create_cr_temp = models.AllowedCompany.objects.filter(
id_number=id_number, create_change_request_template=1
)
cr = False
cr_temp = False
if can_create_cr.count() > 0:
cr = True
if can_create_cr_temp.count() > 0:
cr_temp = True
message = { message = {
'account_no': id_number, 'account_no': id_number,
'pending': pending, 'pending': pending,
...@@ -202,6 +220,8 @@ class ChangeRequestFormsViewset(viewsets.ModelViewSet): ...@@ -202,6 +220,8 @@ class ChangeRequestFormsViewset(viewsets.ModelViewSet):
'normal': normal, 'normal': normal,
'awaiting': awaiting, 'awaiting': awaiting,
'overdue': overdue, 'overdue': overdue,
'cr': cr,
'cr_temp': cr_temp,
'code': 200, 'code': 200,
'status': 'success', 'status': 'success',
'message': 'Dashboard Summary' 'message': 'Dashboard Summary'
...@@ -571,7 +591,7 @@ class ChangeRequestFormsViewset(viewsets.ModelViewSet): ...@@ -571,7 +591,7 @@ class ChangeRequestFormsViewset(viewsets.ModelViewSet):
tmp_prefix = models.ChangeRequestTemplateHeader.objects.get( tmp_prefix = models.ChangeRequestTemplateHeader.objects.get(
template_no=frm.template_no.template_no template_no=frm.template_no.template_no
) )
data_update = { data_update = {
"status": 'Draft', "status": 'Draft',
"created": datetime.now(), "created": datetime.now(),
...@@ -646,23 +666,24 @@ class ChangeRequestFormsViewset(viewsets.ModelViewSet): ...@@ -646,23 +666,24 @@ class ChangeRequestFormsViewset(viewsets.ModelViewSet):
url_path='actions', url_name='actions' url_path='actions', url_name='actions'
) )
def actions(self, request, *args, **kwargs): def actions(self, request, *args, **kwargs):
# get request data
id = request.data['id']
# current_user = request.data['user']
current_user = self.request.user.code current_user = self.request.user.code
form_code = request.data['form_code']
delegation = request.data['delegation'] action_body = request.data
action = request.data['action']
level = request.data['level'] id = action_body.get('id', False)
next_level = int(request.data['level']) + 1 form_code = action_body.get('form_code', False)
remarks = request.data['remarks'] delegation = action_body.get('delegation', False)
action = action_body.get('action', False)
level = action_body.get('level', False)
next_level = int(level) + 1
remarks = action_body.get('remarks', False)
# generate batchno history # generate batchno history
batchno = get_max_batchno("batch") batchno = get_max_batchno("batch")
action_data = { action_data = {
'id': int(request.data['id']), 'id': id,
'action': action, 'action': action,
'remarks': remarks, 'remarks': remarks,
'action_date': datetime.now() 'action_date': datetime.now()
......
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