fix expence income api
This commit is contained in:
@@ -168,17 +168,17 @@ class ExpenceUpdateSerializer(serializers.ModelSerializer):
|
|||||||
if instance.currency == 'uzs':
|
if instance.currency == 'uzs':
|
||||||
cash_transaction.expence_balance_uzs -= (old_price - validated_data.get('price'))
|
cash_transaction.expence_balance_uzs -= (old_price - validated_data.get('price'))
|
||||||
cash_transaction.total_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:
|
else:
|
||||||
cash_transaction.expence_balance_usd -= (old_price - validated_data.get('price'))
|
cash_transaction.expence_balance_usd -= (old_price - validated_data.get('price'))
|
||||||
cash_transaction.total_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'):
|
elif old_price < validated_data.get('price'):
|
||||||
if instance.currency == 'uzs':
|
if instance.currency == 'uzs':
|
||||||
cash_transaction.expence_balance_uzs += (old_price - validated_data.get('price'))
|
cash_transaction.expence_balance_uzs += (old_price - validated_data.get('price'))
|
||||||
cash_transaction.total_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:
|
else:
|
||||||
cash_transaction.expence_balance_usd += (old_price - validated_data.get('price'))
|
cash_transaction.expence_balance_usd += (old_price - validated_data.get('price'))
|
||||||
cash_transaction.total_balance_usd += (old_price - validated_data.get('price'))
|
cash_transaction.total_balance_usd += (old_price - validated_data.get('price'))
|
||||||
|
|||||||
@@ -166,11 +166,11 @@ class IncomeUpdateSerializer(serializers.ModelSerializer):
|
|||||||
if instance.currency == 'uzs':
|
if instance.currency == 'uzs':
|
||||||
cash_transaction.income_balance_uzs -= (old_price - validated_data.get('price'))
|
cash_transaction.income_balance_uzs -= (old_price - validated_data.get('price'))
|
||||||
cash_transaction.total_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:
|
else:
|
||||||
cash_transaction.income_balance_usd -= (old_price - validated_data.get('price'))
|
cash_transaction.income_balance_usd -= (old_price - validated_data.get('price'))
|
||||||
cash_transaction.total_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'):
|
elif old_price < validated_data.get('price'):
|
||||||
if instance.currency == 'uzs':
|
if instance.currency == 'uzs':
|
||||||
|
|||||||
Reference in New Issue
Block a user