From e7c1f8b74f92778f16721a6ad358f4f248f2a9f6 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 14 Feb 2025 15:56:05 +0100 Subject: 🐛 fix VALUES serialization for preventive archaeological files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- archaeological_files/models.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'archaeological_files/models.py') diff --git a/archaeological_files/models.py b/archaeological_files/models.py index 5e586aa28..e753908f9 100644 --- a/archaeological_files/models.py +++ b/archaeological_files/models.py @@ -19,6 +19,7 @@ import datetime from collections import OrderedDict +import json from django.apps import apps from django.conf import settings @@ -1755,6 +1756,19 @@ class PreventiveFileEquipmentServiceCost(models.Model): verbose_name_plural = _("Equipment requirements") ADMIN_SECTION = _("Preventive") + def toJSON(self): + return json.dumps({ + "file": str(self.file), + "equipment_service_cost": str(self.equipment_service_cost), + "quantity_by_day_planned": self.quantity_by_day_planned, + "days_planned": self.days_planned, + "quantity_by_day_worked": self.quantity_by_day_worked, + "days_worked": self.days_worked, + }, + sort_keys=True, + indent=4 + ) + @property def quantity_planned(self): if self.equipment_service_cost.flat_rate: -- cgit v1.2.3