fix party addd
This commit is contained in:
@@ -71,12 +71,13 @@ class Party(BaseModel):
|
||||
self.process = 75
|
||||
elif self.status == 'PARTY_IS_MADE':
|
||||
self.process = 100
|
||||
if hasattr(self, 'party_amount') and self.party_amount.paid_amount > 0 and self.party_amount.payment_amount > 0:
|
||||
self.payment_percentage = (self.party_amount.paid_amount / self.party_amount.payment_amount) * 100
|
||||
self.party_amount.save()
|
||||
else:
|
||||
self.payment_percentage = 100.0
|
||||
self.status == 'PURCHASED'
|
||||
if not self.payment_percentage:
|
||||
if hasattr(self, 'party_amount') and self.party_amount.paid_amount > 0 and self.party_amount.payment_amount > 0:
|
||||
self.payment_percentage = (self.party_amount.paid_amount / self.party_amount.payment_amount) * 100
|
||||
self.party_amount.save()
|
||||
else:
|
||||
self.payment_percentage = 100.0
|
||||
self.status == 'PURCHASED'
|
||||
return super().save(*args, **kwargs)
|
||||
|
||||
class Meta:
|
||||
@@ -91,6 +92,8 @@ class PartyAmount(BaseModel):
|
||||
calculated_amount = models.BigIntegerField(default=0)
|
||||
paid_amount = models.BigIntegerField(default=0)
|
||||
payment_amount = models.BigIntegerField(default=0)
|
||||
debt_amount = models.BigIntegerField(default=0)
|
||||
total_expense_amount = models.BigIntegerField(default=0)
|
||||
|
||||
def __str__(self):
|
||||
return f'{self.party} amount'
|
||||
|
||||
Reference in New Issue
Block a user