diff --git a/core/apps/finance/serializers/expence.py b/core/apps/finance/serializers/expence.py index be1ab8d..54c0833 100644 --- a/core/apps/finance/serializers/expence.py +++ b/core/apps/finance/serializers/expence.py @@ -71,7 +71,10 @@ class ExpenceCreateSerializer(serializers.ModelSerializer): expence.counterparty.total_debit += expence.price expence.counterparty.save() body = f"""{user.full_name} {expence.price} {expence.currency.upper()}... \n screen: /monitoring""" - notify_user(user=user, title="Tasdiqlang yoki rad eting", body=body) + data = { + "screen": "/monitoring" + } + notify_user(user=user, title="Tasdiqlang yoki rad eting", body=body, data=data) cash_transaction.save() payment_type.save() return expence diff --git a/core/apps/notifications/utils/notify_user.py b/core/apps/notifications/utils/notify_user.py index 37f4381..83ef144 100644 --- a/core/apps/notifications/utils/notify_user.py +++ b/core/apps/notifications/utils/notify_user.py @@ -2,7 +2,7 @@ from core.apps.notifications.models import Notification from core.apps.notifications.utils.send_notification import send_notification -def notify_user(user, title, body): +def notify_user(user, title, body, data): tokens = Notification.objects.filter(user=user) for token in tokens: - send_notification(token.token, title, body) \ No newline at end of file + send_notification(token.token, title, body, data) \ No newline at end of file diff --git a/core/apps/orders/serializers/order.py b/core/apps/orders/serializers/order.py index ae9f852..6d3899c 100644 --- a/core/apps/orders/serializers/order.py +++ b/core/apps/orders/serializers/order.py @@ -85,9 +85,12 @@ class MultipleOrderCreateSerializer(serializers.Serializer): employee=self.context.get('user'), ) orders.append(order) - body = f"""{user.full_name} {order.project_folder.name} uchun {order.wherehouse.name} ombor ga {order.quantity} {order.unity.value} {order.product.name} ga buyurtma berdi. Buyurtma yetkazish sanasi {common_date} \n screen: /supply + body = f"""{user.full_name} {order.project_folder.name} uchun {order.wherehouse.name} ombor ga {order.quantity} {order.unity.value} {order.product.name} ga buyurtma berdi. Buyurtma yetkazish sanasi {common_date} """ - notify_user(user=user, title="Ta'minot",body=body) + data = { + "screen": "/supply" + } + notify_user(user=user, title="Ta'minot",body=body, data=data) created_orders = Order.objects.bulk_create(orders) return created_orders