change type
This commit is contained in:
@@ -59,23 +59,23 @@ class Party(BaseModel):
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f'P - {self.number}'
|
return f'P - {self.number}'
|
||||||
|
|
||||||
def save(self, *args, **kwargs):
|
# def save(self, *args, **kwargs):
|
||||||
if self.status in ['NEW', 'CANCELLED', 'DRAFT']:
|
# if self.status in ['NEW', 'CANCELLED', 'DRAFT']:
|
||||||
self.process = 0
|
# self.process = 0
|
||||||
elif self.status == 'EXPECTED':
|
# elif self.status == 'EXPECTED':
|
||||||
self.process = 25
|
# self.process = 25
|
||||||
elif self.status == 'PROCESS':
|
# elif self.status == 'PROCESS':
|
||||||
self.process = 50
|
# self.process = 50
|
||||||
elif self.status == 'PURCHASED':
|
# elif self.status == 'PURCHASED':
|
||||||
self.process = 75
|
# self.process = 75
|
||||||
elif self.status == 'PARTY_IS_MADE':
|
# elif self.status == 'PARTY_IS_MADE':
|
||||||
self.process = 100
|
# self.process = 100
|
||||||
if hasattr(self, 'party_amount') and self.party_amount.paid_amount > 0 and self.party_amount.payment_amount > 0:
|
# 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.payment_percentage = (self.party_amount.paid_amount / self.party_amount.payment_amount) * 100
|
||||||
self.party_amount.save()
|
# self.party_amount.save()
|
||||||
else:
|
# else:
|
||||||
self.payment_percentage = 100
|
# self.payment_percentage = 100
|
||||||
return super().save(*args, **kwargs)
|
# return super().save(*args, **kwargs)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = 'Partiya'
|
verbose_name = 'Partiya'
|
||||||
|
|||||||
Reference in New Issue
Block a user