add new apis

This commit is contained in:
behruz-dev
2025-08-14 13:40:34 +05:00
parent 66aab361ef
commit f2226b94c0
7 changed files with 70 additions and 1752 deletions

View File

@@ -4,6 +4,7 @@ from django.utils.translation import gettext_lazy as _
from core.apps.shared.models import BaseModel
from core.apps.projects.models import Project
from core.apps.products.models import Unity, Product
from core.apps.accounts.models import User
class ProjectEstimate(BaseModel):
@@ -19,6 +20,12 @@ class ProjectEstimate(BaseModel):
class EstimateWork(BaseModel):
STATUS = (
('OPEN', 'ochiq'),
('IN_PROGRESS', 'bajarilmoqda'),
('DONE', 'bajarildi'),
)
number = models.PositiveIntegerField(default=1)
name = models.CharField(max_length=200)
quantity = models.PositiveIntegerField(default=1)
@@ -29,9 +36,15 @@ class EstimateWork(BaseModel):
estimate = models.ForeignKey(
ProjectEstimate, on_delete=models.CASCADE, related_name='estimate_works'
)
date = models.DateField(null=True, blank=True)
date = models.DateField(null=True, blank=True)
total_price = models.PositiveBigIntegerField(default=0)
status = models.CharField(choices=STATUS, max_length=20, default='ochiq')
start_date = models.DateField(null=True, blank=True)
end_date = models.DateField(null=True, blank=True)
employee = models.ManyToManyField(User, related_name='estimate_work', blank=True)
percentage = models.PositiveSmallIntegerField(db_default=0, null=True, blank=True)
def __str__(self):
return f"{self.number}.{self.name}"