orders: fixed old bugs

This commit is contained in:
behruz-dev
2025-11-11 16:56:35 +05:00
parent fe1542b540
commit 4aea353b75
3 changed files with 34 additions and 10 deletions

View File

@@ -42,8 +42,8 @@ class Party(BaseModel):
confirmation = models.CharField(max_length=20, choices=CONFIRMATION, default='EXPECTED')
currency = models.CharField(choices=[('usd', 'usd'), ('uzs', 'uzs')], max_length=3, default='uzs')
# percentages
payment_percentage = models.FloatField(null=True, blank=True)
process = models.FloatField(null=True, blank=True)
payment_percentage = models.FloatField(default=0.0)
process = models.FloatField(default=0.0)
comment = models.TextField(null=True, blank=True)
audit = models.CharField(
@@ -70,10 +70,7 @@ class Party(BaseModel):
elif self.status == 'PURCHASED':
self.process = 75
elif self.status == 'PARTY_IS_MADE':
percentage = 0.0
for order in self.orders.all():
percentage += order.completion_percentage
self.process = percentage
self.process == 100
return super().save(*args, **kwargs)
class Meta: