From a5426138416c504cea6e43cf127f98580de07462 Mon Sep 17 00:00:00 2001 From: behruz-dev Date: Tue, 28 Oct 2025 16:44:29 +0500 Subject: [PATCH] fix --- core/apps/finance/serializers/expence.py | 8 ++++++-- core/apps/finance/urls.py | 2 +- core/apps/orders/serializers/order.py | 4 +--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/core/apps/finance/serializers/expence.py b/core/apps/finance/serializers/expence.py index 8aa4bd4..4055fda 100644 --- a/core/apps/finance/serializers/expence.py +++ b/core/apps/finance/serializers/expence.py @@ -3,6 +3,7 @@ from django.db import transaction from rest_framework import serializers from core.apps.finance.models import Expence +from core.apps.notifications.utils.notify_user import notify_user class ExpenceCreateSerializer(serializers.ModelSerializer): @@ -33,7 +34,7 @@ class ExpenceCreateSerializer(serializers.ModelSerializer): ) cash_transaction = expence.cash_transaction payment_type = expence.payment_type - + user = self.context.get('user') if validated_data.get('currency') == 'uzs': cash_transaction.expence_balance_uzs += expence.price cash_transaction.total_balance_uzs = cash_transaction.income_balance_uzs - cash_transaction.expence_balance_uzs @@ -69,7 +70,10 @@ class ExpenceCreateSerializer(serializers.ModelSerializer): expence.counterparty.debit_usd += validated_data.get('price') 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) cash_transaction.save() payment_type.save() return expence diff --git a/core/apps/finance/urls.py b/core/apps/finance/urls.py index 705ec1b..c8ecdbb 100644 --- a/core/apps/finance/urls.py +++ b/core/apps/finance/urls.py @@ -91,7 +91,7 @@ urlpatterns = [ ] )), path('expence_chat/', include( - [ + [ path('/messages/', ex_chat_views.ExpenceMessageListApiView.as_view()), path('message/', include( [ diff --git a/core/apps/orders/serializers/order.py b/core/apps/orders/serializers/order.py index 3ebc7f4..ae9f852 100644 --- a/core/apps/orders/serializers/order.py +++ b/core/apps/orders/serializers/order.py @@ -85,9 +85,7 @@ 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} + 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 """ notify_user(user=user, title="Ta'minot",body=body)