feat: add new document and documentcategory model for auto evaluation detail

This commit is contained in:
xoliqberdiyev
2026-04-03 16:19:53 +05:00
parent 3664f8f66d
commit 12b19290d6
41 changed files with 681 additions and 26 deletions

View File

@@ -1,6 +1,7 @@
from .auto import * # noqa
from .customer import * # noqa
from .document import * # noqa
from .documentcategory import * # noqa
from .history import * # noqa
from .movable import * # noqa
from .quick import * # noqa

View File

@@ -3,9 +3,10 @@ from django.utils.translation import gettext_lazy as _
from django_core.models import AbstractBaseModel
from model_bakery import baker
from .valuation import ValuationModel
from core.apps.evaluation.choices.document import DocumentType
from .valuation import ValuationModel
class ValuationDocumentModel(AbstractBaseModel):
valuation = models.ForeignKey(
@@ -54,3 +55,35 @@ class ValuationDocumentModel(AbstractBaseModel):
verbose_name = _("Valuation Document")
verbose_name_plural = _("Valuation Documents")
ordering = ["-created_at"]
class DocumentModel(AbstractBaseModel):
auto_evaluation = models.ForeignKey(
"evaluation.AutoEvaluationModel",
on_delete=models.CASCADE,
related_name="documents",
verbose_name=_("auto evaluation"),
)
title = models.CharField(verbose_name=_("title"), max_length=255)
document = models.FileField(
verbose_name=_("document"),
upload_to="evaluation/documents/%Y/%m/",
)
category = models.ForeignKey(
"evaluation.DocumentCategoryModel",
on_delete=models.CASCADE,
related_name="documents",
verbose_name=_("category"),
)
def __str__(self):
return str(self.pk)
@classmethod
def _baker(cls):
return baker.make(cls)
class Meta:
db_table = "Document"
verbose_name = _("DocumentModel")
verbose_name_plural = _("DocumentModels")

View File

@@ -0,0 +1,21 @@
from django.db import models
from django.utils.translation import gettext_lazy as _
from django_core.models import AbstractBaseModel
from model_bakery import baker
class DocumentcategoryModel(AbstractBaseModel):
label = models.CharField(verbose_name=_("label"), max_length=255)
value = models.CharField(verbose_name=_("value"), max_length=255)
def __str__(self):
return str(self.pk)
@classmethod
def _baker(cls):
return baker.make(cls)
class Meta:
db_table = "DocumentCategory"
verbose_name = _("DocumentcategoryModel")
verbose_name_plural = _("DocumentcategoryModels")