diff --git a/core/apps/finance/serializers/expence.py b/core/apps/finance/serializers/expence.py index 605f071..12cb9d3 100644 --- a/core/apps/finance/serializers/expence.py +++ b/core/apps/finance/serializers/expence.py @@ -168,17 +168,17 @@ class ExpenceUpdateSerializer(serializers.ModelSerializer): if instance.currency == 'uzs': cash_transaction.expence_balance_uzs -= (old_price - validated_data.get('price')) cash_transaction.total_balance_uzs -= (old_price - validated_data.get('price')) - payment_type.total_uzs -= (old_price - validated_data.get('price')) + payment_type.total_uzs -= (old_price - validated_data.get('price')) if payment_type.total_uzs > (old_price - validated_data.get('price')) else 0 else: cash_transaction.expence_balance_usd -= (old_price - validated_data.get('price')) cash_transaction.total_balance_usd -= (old_price - validated_data.get('price')) - payment_type.total_usd -= (old_price - validated_data.get('price')) + payment_type.total_usd -= (old_price - validated_data.get('price')) if payment_type.total_usd > (old_price - validated_data.get('price')) else 0 elif old_price < validated_data.get('price'): if instance.currency == 'uzs': cash_transaction.expence_balance_uzs += (old_price - validated_data.get('price')) cash_transaction.total_balance_uzs += (old_price - validated_data.get('price')) - payment_type.total_uzs += (old_price - validated_data.get('price')) + payment_type.total_uzs += (old_price - validated_data.get('price')) else: cash_transaction.expence_balance_usd += (old_price - validated_data.get('price')) cash_transaction.total_balance_usd += (old_price - validated_data.get('price')) diff --git a/core/apps/finance/serializers/income.py b/core/apps/finance/serializers/income.py index 3e801e4..b6b75ac 100644 --- a/core/apps/finance/serializers/income.py +++ b/core/apps/finance/serializers/income.py @@ -166,11 +166,11 @@ class IncomeUpdateSerializer(serializers.ModelSerializer): if instance.currency == 'uzs': cash_transaction.income_balance_uzs -= (old_price - validated_data.get('price')) cash_transaction.total_balance_uzs -= (old_price - validated_data.get('price')) - payment_type.total_uzs -= (old_price - validated_data.get('price')) + payment_type.total_uzs -= (old_price - validated_data.get('price')) if payment_type.total_uzs > (old_price - validated_data.get('price')) else 0 else: cash_transaction.income_balance_usd -= (old_price - validated_data.get('price')) cash_transaction.total_balance_usd -= (old_price - validated_data.get('price')) - payment_type.total_usd -= (old_price - validated_data.get('price')) + payment_type.total_usd -= (old_price - validated_data.get('price')) if payment_type.total_usd > (old_price - validated_data.get('price')) else 0 elif old_price < validated_data.get('price'): if instance.currency == 'uzs':