fix
This commit is contained in:
@@ -3,6 +3,7 @@ from django.db import transaction
|
|||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
|
||||||
from core.apps.finance.models import Expence
|
from core.apps.finance.models import Expence
|
||||||
|
from core.apps.notifications.utils.notify_user import notify_user
|
||||||
|
|
||||||
|
|
||||||
class ExpenceCreateSerializer(serializers.ModelSerializer):
|
class ExpenceCreateSerializer(serializers.ModelSerializer):
|
||||||
@@ -33,7 +34,7 @@ class ExpenceCreateSerializer(serializers.ModelSerializer):
|
|||||||
)
|
)
|
||||||
cash_transaction = expence.cash_transaction
|
cash_transaction = expence.cash_transaction
|
||||||
payment_type = expence.payment_type
|
payment_type = expence.payment_type
|
||||||
|
user = self.context.get('user')
|
||||||
if validated_data.get('currency') == 'uzs':
|
if validated_data.get('currency') == 'uzs':
|
||||||
cash_transaction.expence_balance_uzs += expence.price
|
cash_transaction.expence_balance_uzs += expence.price
|
||||||
cash_transaction.total_balance_uzs = cash_transaction.income_balance_uzs - cash_transaction.expence_balance_uzs
|
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.debit_usd += validated_data.get('price')
|
||||||
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
|
||||||
|
"""
|
||||||
|
notify_user(user=user, title="Tasdiqlang yoki rad eting", body=body)
|
||||||
cash_transaction.save()
|
cash_transaction.save()
|
||||||
payment_type.save()
|
payment_type.save()
|
||||||
return expence
|
return expence
|
||||||
|
|||||||
@@ -85,9 +85,7 @@ class MultipleOrderCreateSerializer(serializers.Serializer):
|
|||||||
employee=self.context.get('user'),
|
employee=self.context.get('user'),
|
||||||
)
|
)
|
||||||
orders.append(order)
|
orders.append(order)
|
||||||
body = f"""
|
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
|
||||||
{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)
|
notify_user(user=user, title="Ta'minot",body=body)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user