Commit e61ce357 authored by Gladys Forte's avatar Gladys Forte

Merge pull request #427 in RMS/api-main-service from gladys-dev2 to RMSv2

* commit '81195119':
  cron
parents 857fceef 81195119
......@@ -10,11 +10,14 @@ from django.conf import settings
from datetime import timedelta
from app.helper.email_service import sender
from app.applicationlayer.utils import main_threading
from rest_framework.permissions import AllowAny
CR_FRONT_LINK = settings.CR_FRONT_LINK
class ReminderTriggerAPIView(views.APIView):
permission_classes = (AllowAny,)
def get(self, request):
date_now = datetime.now()
next_day = date_now + timedelta(days=1)
......
......@@ -1155,7 +1155,7 @@ class ChangeRequestFormsViewset(viewsets.ModelViewSet):
new_instance = model_to_dict(form_header)
print(serializer.errors)
# print(serializer.errors)
# save history in form header
crhistory_create_save(
......
......@@ -361,6 +361,12 @@ class ChangeRequestTemplatePost(APIView):
}
sp1 = transaction.savepoint() # nothing will save to db
# cr_prefix = request.data['requested_to_template_id'])
# models.ChangeRequestTemplateHeader.objects.filter(
# requested_to_template_id=cr_prefix
# )
serializer = ChangeRequestTemplatesSerializer(
data=template_header_data)
......
......@@ -219,7 +219,7 @@ def send_mail_vendor(requestor,
# create notification
notification_create(form_code, message, vendor_code,
sender_code)
sender_code, 'cms')
def send_mail_requestor(current_user,
......@@ -287,7 +287,7 @@ def send_mail_requestor(current_user,
# create notification
notification_create(form_code, message, requestor_code,
current_user)
current_user, 'cms')
def next_approver_email(form_code, next_level):
......@@ -361,7 +361,7 @@ def next_approver_email(form_code, next_level):
# create notification
notification_create(form_code, message, receiver_code,
sender_code)
sender_code, 'cms')
def cancel_overdue(request):
......
......@@ -161,7 +161,8 @@ def send_broadcast_message(room_name, sender, message):
ws.close()
def notification_create(form_code, message, account_no, sender_account_no):
def notification_create(form_code, message, account_no,
sender_account_no, app):
try:
......@@ -170,7 +171,7 @@ def notification_create(form_code, message, account_no, sender_account_no):
notif_type='TASK',
message=message,
is_read=False,
app='APP-20190909-0000002',
app=app,
account_no=account_no,
sender_account_no=sender_account_no
)
......@@ -184,12 +185,6 @@ def notification_create(form_code, message, account_no, sender_account_no):
'NEW NOTIFICATIONS'
)
# message = {
# 'code': 200,
# 'status': 'success',
# 'message': 'Notification successfully created!',
# }
# return Response(message, status=status.HTTP_200_OK)
return True
except Exception as e:
......
......@@ -523,7 +523,7 @@ class ChangeRequestTemplateHeader(BaseHeader):
on_delete=models.PROTECT,
to_field='code',
related_name='created_by_user')
created_by_department = models.ForeignKey(
Department,
on_delete=models.PROTECT,
......
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