fix: inverted transaction price
This commit is contained in:
@@ -14,7 +14,7 @@ def booking_post_save(sender, instance: Booking, created: bool, **kwargs):
|
|||||||
transaction = Transaction.objects.filter(booking=instance).first()
|
transaction = Transaction.objects.filter(booking=instance).first()
|
||||||
if transaction:
|
if transaction:
|
||||||
if with_transaction:
|
if with_transaction:
|
||||||
transaction.amount = amount
|
transaction.amount = -amount
|
||||||
transaction.description = description
|
transaction.description = description
|
||||||
transaction.save()
|
transaction.save()
|
||||||
else:
|
else:
|
||||||
@@ -23,7 +23,7 @@ def booking_post_save(sender, instance: Booking, created: bool, **kwargs):
|
|||||||
elif with_transaction:
|
elif with_transaction:
|
||||||
Transaction.objects.create(
|
Transaction.objects.create(
|
||||||
account=instance.user.account,
|
account=instance.user.account,
|
||||||
amount=amount,
|
amount=-amount,
|
||||||
description=description,
|
description=description,
|
||||||
booking=instance,
|
booking=instance,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user