fix part
This commit is contained in:
@@ -97,27 +97,15 @@ class PartyAmount(BaseModel):
|
|||||||
overdue_amount = models.BigIntegerField(default=0)
|
overdue_amount = models.BigIntegerField(default=0)
|
||||||
|
|
||||||
def save(self, *args, **kwargs):
|
def save(self, *args, **kwargs):
|
||||||
if self.calculated_amount != 0:
|
if self.calculated_amount < self.paid_amount:
|
||||||
if self.calculated_amount < self.paid_amount:
|
self.overdue_amount = self.paid_amount - self.calculated_amount
|
||||||
self.overdue_amount = self.paid_amount - self.calculated_amount
|
self.payment_amount = 0
|
||||||
self.payment_amount = 0
|
elif self.calculated_amount > self.paid_amount:
|
||||||
elif self.calculated_amount > self.paid_amount:
|
self.payment_amount = self.calculated_amount - self.paid_amount
|
||||||
self.payment_amount = self.calculated_amount - self.paid_amount
|
self.overdue_amount = 0
|
||||||
self.overdue_amount = 0
|
|
||||||
else:
|
|
||||||
self.overdue_amount = 0
|
|
||||||
self.payment_amount = 0
|
|
||||||
else:
|
else:
|
||||||
if self.total_price < self.paid_amount:
|
self.overdue_amount = 0
|
||||||
self.overdue_amount = self.paid_amount - self.total_price
|
self.payment_amount = 0
|
||||||
self.payment_amount = 0
|
|
||||||
elif self.total_price > self.paid_amount:
|
|
||||||
self.payment_amount = self.total_price - self.paid_amount
|
|
||||||
self.overdue_amount = 0
|
|
||||||
else:
|
|
||||||
self.overdue_amount = 0
|
|
||||||
self.payment_amount = 0
|
|
||||||
|
|
||||||
return super().save(*args, **kwargs)
|
return super().save(*args, **kwargs)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user