add: add new api for expence

This commit is contained in:
behruz-dev
2025-09-24 18:51:25 +05:00
parent 29868034f2
commit b5a0aa607e
5 changed files with 55 additions and 3 deletions

View File

@@ -7,6 +7,11 @@ from core.apps.accounts.models import User
class Expence(BaseModel):
STATUS = (
('CANCELLED', 'rad etildi'),
('PENDING', 'kutilmoqda'),
('CONFIRMED', 'tasdiqlangan'),
)
user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='expences', null=True)
cash_transaction = models.ForeignKey(CashTransaction, on_delete=models.CASCADE, related_name='expences')
payment_type = models.ForeignKey(PaymentType, on_delete=models.CASCADE, related_name='expences')
@@ -35,6 +40,7 @@ class Expence(BaseModel):
comment = models.TextField(null=True, blank=True)
audit = models.CharField(max_length=200, null=True, blank=True)
file = models.FileField(null=True, blank=True, upload_to='finance/expence/files/')
status = models.CharField(max_length=20, choices=STATUS, default='PENDING', null=True, blank=True)
def __str__(self):
return f'{self.cash_transaction} kassa uchun chiqim {self.price}'