diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-04-22 17:50:10 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2022-07-08 09:58:47 +0200 |
commit | c706c72acceef2665bd0a44214401fcb9cd38033 (patch) | |
tree | de77f6080d70405398d639b4162fc923eaf2cf81 /archaeological_files/models.py | |
parent | cccde539177da309bc3af5549bccaa65aca172ca (diff) | |
download | Ishtar-c706c72acceef2665bd0a44214401fcb9cd38033.tar.bz2 Ishtar-c706c72acceef2665bd0a44214401fcb9cd38033.zip |
File: preventive fields
Diffstat (limited to 'archaeological_files/models.py')
-rw-r--r-- | archaeological_files/models.py | 125 |
1 files changed, 125 insertions, 0 deletions
diff --git a/archaeological_files/models.py b/archaeological_files/models.py index 88326d405..db46c1ca7 100644 --- a/archaeological_files/models.py +++ b/archaeological_files/models.py @@ -68,6 +68,85 @@ from archaeological_operations.models import ( ) +class Job(GeneralType): + ground_daily_cost = models.FloatField(_("Ground daily cost"), blank=True, null=True) + daily_cost = models.FloatField(_("Daily cost"), blank=True, null=True) + permanent_contract = models.NullBooleanField( + _("Is a permanent contract"), blank=True, null=True) + default_daily_need_on_ground = models.FloatField( + _("Default daily number needed on the ground"), default=0) + default_daily_need = models.FloatField( + _("Default daily number needed"), default=0) + + class Meta: + verbose_name = _("Job") + verbose_name_plural = _("Jobs") + ordering = ("label",) + + +class GenericEquipmentType(GeneralType): + class Meta: + verbose_name = _("Generic equipment type") + verbose_name_plural = _("Generic equipment types") + ordering = ("label",) + + +class EquipmentType(GeneralType): + generic_equipment_type = models.ForeignKey( + GenericEquipmentType, verbose_name=_("Generic type")) + + class Meta: + verbose_name = _("Equipment type") + verbose_name_plural = _("Equipment types") + ordering = ("label",) + + +class EquipmentCost(models.Model): + service_provider = models.CharField(_("Service provider"), max_length=200, + default="-") + equipment_type = models.ForeignKey( + EquipmentType, verbose_name=_("Equipment")) + flat_rate = models.BooleanField(_("Flat rate"), default=False) + daily_cost = models.FloatField(_("Daily cost"), blank=True, null=True) + monday = models.BooleanField(_("Monday"), default=True) + tuesday = models.BooleanField(_("Tuesday"), default=True) + wednesday = models.BooleanField(_("Wednesday"), default=True) + thursday = models.BooleanField(_("Thursday"), default=True) + friday = models.BooleanField(_("Friday"), default=True) + + class Meta: + verbose_name = _("Equipment cost") + verbose_name_plural = _("Equipment costs") + + +class TechnicalService(GeneralType): + class Meta: + verbose_name = _("Technical service") + verbose_name_plural = _("Technical services") + ordering = ("label",) + + +TECH_UNITS = ( + ("D", _("Days")), + ("M", _("Linear meter")), +) + + +class TechnicalServiceCost(models.Model): + service_provider = models.CharField(_("Service provider"), max_length=200, + default="-") + technical_service = models.ForeignKey( + TechnicalService, verbose_name=_("Technical service")) + flat_rate = models.BooleanField(_("Flat rate"), default=False) + unitary_cost = models.FloatField(_("Unitary cost"), blank=True, null=True) + unit = models.CharField(_("Unit"), max_length=1, choices=TECH_UNITS, + blank=True, null=True) + + class Meta: + verbose_name = _("Equipment cost") + verbose_name_plural = _("Equipment costs") + + class FileType(GeneralType): class Meta: verbose_name = _("Archaeological file type") @@ -1061,3 +1140,49 @@ class FileDashboard: .annotate(number=Sum("file__total_surface")) .order_by("department__label") ) + + +class PreventiveFile(models.Model): + file = models.ForeignKey(File, verbose_name=_("File")) + study_period = models.CharField(_("Study period"), max_length=200, + default="", blank=True) + start_date = models.DateField(_("Start date"), blank=True, null=True) + end_date = models.DateField(_("End date"), blank=True, null=True) + ground_start_date = models.DateField(_("Ground start date"), blank=True, null=True) + ground_end_date = models.DateField(_("Ground end date"), blank=True, null=True) + execution_report_date = models.DateField(_("Execution report date"), blank=True, + null=True) + linear_meter = models.IntegerField(_("Linear meter"), blank=True, null=True) + + class Meta: + verbose_name = _("Preventive file") + verbose_name_plural = _("Preventive files") + + +class ManDays(models.Model): + man_days_planned = models.FloatField( + _("Man-day planned"), null=True, blank=True) + man_days_worked = models.FloatField( + _("Man-day worked"), null=True, blank=True) + + class Meta: + abstract = True + + +class PreventiveFileJob(ManDays): + file = models.ForeignKey(PreventiveFile) + job = models.ForeignKey(Job) + ground_man_days_planned = models.FloatField( + _("Ground man-day planned"), null=True, blank=True) + ground_man_days_worked = models.FloatField( + _("Ground man-day worked"), null=True, blank=True) + + +class PreventiveFileEquipmentCost(ManDays): + file = models.ForeignKey(PreventiveFile) + equipment_cost = models.ForeignKey(EquipmentCost) + + +class PreventiveFileTechnicalServiceCost(ManDays): + file = models.ForeignKey(PreventiveFile) + technical_service_cost = models.ForeignKey(TechnicalServiceCost) |