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

try action rejected

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