change price type int -> decimal field

This commit is contained in:
behruz-dev
2025-11-07 12:17:57 +05:00
parent c113f003df
commit 8dca5505d8
35 changed files with 584 additions and 195 deletions

View File

@@ -28,13 +28,13 @@ class CashTransaction(BaseModel):
CashTransactionFolder, on_delete=models.SET_NULL, related_name='cash_transactions',
null=True, blank=True
)
total_balance_usd = models.BigIntegerField(default=0)
income_balance_usd = models.BigIntegerField(default=0)
expence_balance_usd = models.BigIntegerField(default=0)
total_balance_usd = models.DecimalField(max_digits=15, decimal_places=2, default=0.00)
income_balance_usd = models.DecimalField(max_digits=15, decimal_places=2, default=0.00)
expence_balance_usd = models.DecimalField(max_digits=15, decimal_places=2, default=0.00)
total_balance_uzs = models.BigIntegerField(default=0)
income_balance_uzs = models.BigIntegerField(default=0)
expence_balance_uzs = models.BigIntegerField(default=0)
total_balance_uzs = models.DecimalField(max_digits=15, decimal_places=2, default=0.00)
income_balance_uzs = models.DecimalField(max_digits=15, decimal_places=2, default=0.00)
expence_balance_uzs = models.DecimalField(max_digits=15, decimal_places=2, default=0.00)
def __str__(self):
return self.name

View File

@@ -31,7 +31,7 @@ class Expence(BaseModel):
'orders.Party', on_delete=models.SET_NULL, null=True, blank=True, related_name='expences'
)
price = models.PositiveBigIntegerField()
price = models.DecimalField(max_digits=15, decimal_places=2, default=0.00)
exchange_rate = models.PositiveBigIntegerField(default=0, null=True, blank=True)
currency = models.CharField(
max_length=3, choices=[('usd','usd'), ('uzs', 'uzs')]

View File

@@ -21,9 +21,9 @@ class ExpenceContract(BaseModel):
Counterparty, on_delete=models.SET_NULL, related_name='expence_contracts', null=True, blank=True
)
price = models.PositiveBigIntegerField()
price = models.DecimalField(max_digits=15, decimal_places=2, default=0.00)
currency = models.CharField(max_length=3, choices=[('uzs', 'uzs'), ('usd', 'usd')])
paid_price = models.PositiveBigIntegerField(default=0, null=True, blank=True)
paid_price = models.DecimalField(max_digits=15, decimal_places=2, default=0.00)
date = models.DateField()
comment = models.TextField(null=True, blank=True)

View File

@@ -26,7 +26,7 @@ class Income(BaseModel):
)
currency = models.CharField(choices=[('uzs', 'uzs'),('usd', 'usd')], max_length=3)
price = models.PositiveBigIntegerField()
price = models.DecimalField(max_digits=15, decimal_places=2, default=0.00)
exchange_rate = models.PositiveBigIntegerField(default=0, null=True, blank=True)
date = models.DateField(null=True, blank=True)
comment = models.TextField(null=True, blank=True)

View File

@@ -21,9 +21,9 @@ class IncomeContract(BaseModel):
)
user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='income_contracts')
price = models.PositiveBigIntegerField()
price = models.DecimalField(max_digits=15, decimal_places=2, default=0.00)
currency = models.CharField(max_length=3, choices=[('uzs', 'uzs'), ('usd', 'usd')])
paid_price = models.PositiveBigIntegerField(default=0, null=True, blank=True)
paid_price = models.DecimalField(max_digits=15, decimal_places=2, default=0.00)
date = models.DateField()
comment = models.TextField(null=True, blank=True)

View File

@@ -6,8 +6,8 @@ from core.apps.shared.models import BaseModel
class PaymentType(BaseModel):
name = models.CharField(max_length=200, unique=True)
total_uzs = models.PositiveBigIntegerField(default=0)
total_usd = models.PositiveBigIntegerField(default=0)
total_uzs = models.DecimalField(max_digits=15, decimal_places=2, default=0.00)
total_usd = models.DecimalField(max_digits=15, decimal_places=2, default=0.00)
def __str__(self):
return self.name