from django.db import models from dbsynce.models.resource import Resource from dbsynce.models.company import Company from dbsynce.models.service_category import ServiceCategory from tickets.models import Ticket from dbsynce.docs.database.service import Service as HelpTexts from core.settings_vars import METASERVICE_ID class Service(models.Model): """ service - спецификация услуги каждого конкретного поставщика (например, в рамках сервиса многие могут предоставлять услуги перевозки, но конкретный шаблон с конкретным тарифом относится к отдельному перевозчику) """ # ID METASERVICE id_metaservice = models.PositiveIntegerField( default=METASERVICE_ID, help_text=HelpTexts.id_metaservice ) codename = models.CharField( max_length=30, #help_text=HelpTexts.codename ) requirements = models.CharField( max_length=300, #TODO fix default value! default="DSMPU", #help_text=HelpTexts.requirements ) caption = models.CharField( max_length=255, null=True, #help_text=HelpTexts.caption ) description = models.TextField( blank=True, #help_text=HelpTexts.description ) resource_type = models.CharField( max_length=5, null=True, #help_text=HelpTexts.resource_type ) # DATA #price_type = models.ForeignKey( # ServiceCategory, # max_length=1, # help_text=HelpTexts.price_type #) price_km = models.DecimalField( max_digits=9, decimal_places=2, null=True, help_text=HelpTexts.price_km ) price_min = models.DecimalField( max_digits=9, decimal_places=2, null=True, help_text=HelpTexts.price_min ) price_amount = models.DecimalField( max_digits=9, decimal_places=2, null=True, help_text=HelpTexts.price_amount ) company_comission = models.FloatField( help_text=HelpTexts.company_comission ) requirements = models.CharField( max_length=50, help_text=HelpTexts.requirements ) status = models.CharField( max_length=1, help_text=HelpTexts.status, default="1", ) # OTHER is_global = models.CharField( max_length=1, default="f", help_text=HelpTexts.is_global ) is_visible = models.CharField( max_length=1, default="f", help_text=HelpTexts.is_visible ) # FK ticket_status = models.ForeignKey( Ticket, null=True, on_delete=models.DO_NOTHING, help_text=HelpTexts.ticket_status ) #resource = models.ForeignKey( # Resource, # on_delete=models.DO_NOTHING, # blank=True, # null=True, # help_text=HelpTexts.resource #) company = models.ForeignKey( Company, on_delete=models.DO_NOTHING, blank=True, null=True, #help_text=HelpTexts.company ) service_category = models.ForeignKey( ServiceCategory, on_delete=models.DO_NOTHING, help_text=HelpTexts.service_category ) class Meta: db_table = "service" verbose_name = "Услуга" verbose_name_plural = "Услуги"