change type
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
# Generated by Django 5.2.4 on 2025-10-07 16:28
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('orders', '0026_alter_order_qqs_alter_order_qqs_price_and_more'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='partyamount',
|
||||
name='calculated_amount',
|
||||
field=models.BigIntegerField(default=0),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='partyamount',
|
||||
name='cost_amount',
|
||||
field=models.BigIntegerField(default=0),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='partyamount',
|
||||
name='paid_amount',
|
||||
field=models.BigIntegerField(default=0),
|
||||
),
|
||||
]
|
||||
@@ -70,11 +70,11 @@ 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
|
||||
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
|
||||
return super().save(*args, **kwargs)
|
||||
|
||||
class Meta:
|
||||
@@ -85,9 +85,9 @@ class Party(BaseModel):
|
||||
class PartyAmount(BaseModel):
|
||||
party = models.OneToOneField(Party, on_delete=models.CASCADE, related_name='party_amount')
|
||||
total_price = models.PositiveBigIntegerField()
|
||||
cost_amount = models.PositiveBigIntegerField(default=0)
|
||||
calculated_amount = models.PositiveBigIntegerField(default=0)
|
||||
paid_amount = models.PositiveBigIntegerField(default=0)
|
||||
cost_amount = models.BigIntegerField(default=0)
|
||||
calculated_amount = models.BigIntegerField(default=0)
|
||||
paid_amount = models.BigIntegerField(default=0)
|
||||
payment_amount = models.BigIntegerField(default=0)
|
||||
|
||||
def __str__(self):
|
||||
|
||||
Reference in New Issue
Block a user