Commit 39587ad4 authored by Gladys Forte's avatar Gladys Forte

history onbehalf key

parent f7a7c2a7
......@@ -717,7 +717,10 @@ class ChangeRequestFormsViewset(viewsets.ModelViewSet):
}
else:
data_update = {
"on_behalf": current_user
"on_behalf": {
'code': self.request.user.code,
'name': self.request.user.name
}
}
new_instance = {**new_instance, **data_update}
......@@ -1069,6 +1072,18 @@ class ChangeRequestFormsViewset(viewsets.ModelViewSet):
data = data['toValue'].replace("'", '"').replace('None', '""').replace('True', '""').replace('False', '""')
convert = json.loads(data)
try:
if convert['on_behalf'] and not convert['on_behalf'] == None:
# format: Rejected on behalf by Rita Fantilga
on_behalf = (
convert['action'].capitalize() +
' on behalf by ' +
convert['on_behalf']['name'])
else:
on_behalf = None
except Exception as e:
on_behalf = None
history_dict = {
"name": convert['user']['name'],
"department" : convert['department']['name'],
......@@ -1076,7 +1091,8 @@ class ChangeRequestFormsViewset(viewsets.ModelViewSet):
"date_sent" : convert['date_sent'],
"delegation" : convert['delegation'],
"action" : convert['action'],
"remarks" : convert['remarks'] & convert['on_behalf'],
"remarks" : convert['remarks'],
"on_behalf": on_behalf,
"created": convert['action_date']
}
......
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