fix expence income api
This commit is contained in:
@@ -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'))
|
||||
|
||||
Reference in New Issue
Block a user