add: add income model and income create and list apig

This commit is contained in:
behruz-dev
2025-09-08 17:32:39 +05:00
parent d84612af13
commit ffe9215892
9 changed files with 256 additions and 9 deletions

View File

@@ -14,13 +14,13 @@ class Income(BaseModel):
'projects.ProjectFolder', on_delete=models.CASCADE, related_name='incomes'
)
project = models.ForeignKey(
'projects.Project', on_delete=models.SET_NULL, related_name='incomes', null=True
'projects.Project', on_delete=models.SET_NULL, related_name='incomes', null=True, blank=True
)
counterparty = models.ForeignKey(
Counterparty, on_delete=models.SET_NULL, related_name='incomes', null=True
Counterparty, on_delete=models.SET_NULL, related_name='incomes', null=True, blank=True
)
type_income = models.ForeignKey(
TypeIncome, on_delete=models.SET_NULL, related_name='incomes', null=True
TypeIncome, on_delete=models.SET_NULL, related_name='incomes', null=True, blank=True
)
currency = models.CharField(choices=[('uzs', 'uzs'),('usd', 'usd')], max_length=3)
@@ -29,7 +29,7 @@ class Income(BaseModel):
date = models.DateField()
comment = models.TextField(null=True, blank=True)
file = models.FileField(upload_to='finance/income/file/', null=True, blank=True)
audit = models.CharField(max_length=200)
audit = models.CharField(max_length=200, null=True, blank=True)
def __str__(self):
return f'{self.cash_transaction} kassa uchun kirim {self.price}'