This commit is contained in:
behruz-dev
2025-10-28 17:03:04 +05:00
parent fe543fad5a
commit 9efc8aef40
3 changed files with 11 additions and 5 deletions

View File

@@ -71,7 +71,10 @@ class ExpenceCreateSerializer(serializers.ModelSerializer):
expence.counterparty.total_debit += expence.price expence.counterparty.total_debit += expence.price
expence.counterparty.save() expence.counterparty.save()
body = f"""{user.full_name} {expence.price} {expence.currency.upper()}... \n screen: /monitoring""" 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() cash_transaction.save()
payment_type.save() payment_type.save()
return expence return expence

View File

@@ -2,7 +2,7 @@ from core.apps.notifications.models import Notification
from core.apps.notifications.utils.send_notification import send_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) tokens = Notification.objects.filter(user=user)
for token in tokens: for token in tokens:
send_notification(token.token, title, body) send_notification(token.token, title, body, data)

View File

@@ -85,9 +85,12 @@ class MultipleOrderCreateSerializer(serializers.Serializer):
employee=self.context.get('user'), employee=self.context.get('user'),
) )
orders.append(order) 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) created_orders = Order.objects.bulk_create(orders)
return created_orders return created_orders