Commit 02aa4b16 authored by John Red Medrano's avatar John Red Medrano

Merge branch 'product-dev' of http://42.61.118.105:7990/scm/rms/api-main-service into red-develop

parents b1a6e858 6e86c6d3
......@@ -708,7 +708,23 @@ class ChangeRequestFormsViewset(viewsets.ModelViewSet):
self.perform_update(serializer)
new_instance = serializer.data
original_user = new_instance['user']['code']
if original_user == current_user:
data_update = {
"on_behalf": None
}
else:
data_update = {
"on_behalf": {
'code': self.request.user.code,
'name': self.request.user.name
}
}
new_instance = {**new_instance, **data_update}
crhistory_save(
batchno,
enums.CREnum.ACTION.value,
......@@ -1056,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'],
......@@ -1064,6 +1092,7 @@ class ChangeRequestFormsViewset(viewsets.ModelViewSet):
"delegation" : convert['delegation'],
"action" : convert['action'],
"remarks" : convert['remarks'],
"on_behalf": on_behalf,
"created": convert['action_date']
}
......
......@@ -24,18 +24,6 @@ from app.applicationlayer.utils import (QuerySetHelper,
send_broadcast_message)
from app.businesslayer.changerequest import change_request
from app.applicationlayer.cms.utils_cr import (number_generator,
send_mail_requestor,
next_approver_email,
crhistory_save,
send_mail_vendor,
get_max_batchno,
generate_template_id,
crhistory_create_save,
entity_log_bulk,
reminder_trigger_save,
overdue_trigger_save,
reset_autoemail_tables)
from app.entities import enums
from app.applicationlayer.utils import model_to_dict
......@@ -67,25 +55,9 @@ from django_filters.rest_framework import DjangoFilterBackend
import json
from app.applicationlayer.utils import main_threading
from django.core.files.base import ContentFile
from django.conf import settings
from io import BytesIO
from django.http import HttpResponse
from xhtml2pdf import pisa
config = configparser.ConfigParser()
config_file = os.path.join('./', 'env.ini')
config.read(config_file)
APPROVER_MESSAGE = settings.APPROVER_MESSAGE
REQUESTOR_MESSAGE = settings.REQUESTOR_MESSAGE
REQUESTOR_REJECT_MESSAGE = settings.REQUESTOR_REJECT_MESSAGE
VENDOR_ACKNOWLEDGE_MESSAGE = settings.VENDOR_ACKNOWLEDGE_MESSAGE
REQUESTOR_ACKNOWLEDGE_MESSAGE = settings.REQUESTOR_ACKNOWLEDGE_MESSAGE
REQUESTOR_COMPLETION_MESSAGE = settings.REQUESTOR_COMPLETION_MESSAGE
VENDOR_ACCEPTANCE_MESSAGE = settings.VENDOR_ACCEPTANCE_MESSAGE
VENDOR_REJECT_MESSAGE = settings.VENDOR_REJECT_MESSAGE
class ChangeRequestFormsViewset(viewsets.ModelViewSet):
......
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