diff options
Diffstat (limited to 'archaeological_warehouse')
-rw-r--r-- | archaeological_warehouse/forms.py | 12 | ||||
-rw-r--r-- | archaeological_warehouse/tests.py | 14 |
2 files changed, 17 insertions, 9 deletions
diff --git a/archaeological_warehouse/forms.py b/archaeological_warehouse/forms.py index c681869ad..b100c72bc 100644 --- a/archaeological_warehouse/forms.py +++ b/archaeological_warehouse/forms.py @@ -52,7 +52,8 @@ from archaeological_finds.models import ( RemarkabilityType, TreatmentEmergencyType, Treatment, - TreatmentState, + TreatmentInputStatus, + TreatmentStatus, TreatmentType, ) from . import models @@ -874,10 +875,12 @@ class QAContainerMoveForm(QABasePackagingForm): if not self.cleaned_data.get("create_treatment", False): return treat_type = TreatmentType.objects.get(pk=self.cleaned_data['treatment_type']) - treat_state = TreatmentState.get_completed_state() + treat_input_status = TreatmentInputStatus.get_validated_state() + treat_status = TreatmentStatus.get_completed_state() try: - location = models.Warehouse.objects.get(pk=self.cleaned_data.get("qalocation", None)) + location = models.Warehouse.objects.get( + pk=self.cleaned_data.get("qalocation", None)) except models.Warehouse.DoesNotExist: location = None @@ -890,7 +893,8 @@ class QAContainerMoveForm(QABasePackagingForm): person_id=self.cleaned_data['person'], organization_id=self.cleaned_data['organization'], history_modifier=user, - treatment_state=treat_state + input_status=treat_input_status, + treatment_status=treat_status, ) t.treatment_types.add(treat_type) t.save() diff --git a/archaeological_warehouse/tests.py b/archaeological_warehouse/tests.py index d00156d90..896014c0d 100644 --- a/archaeological_warehouse/tests.py +++ b/archaeological_warehouse/tests.py @@ -41,9 +41,10 @@ from ishtar_common.tests import ( from ishtar_common.models import IshtarSiteProfile, ProfileType, UserProfile from archaeological_operations.models import Operation from archaeological_context_records.models import ContextRecord -from archaeological_finds.models import \ - Find, MaterialType, Treatment, TreatmentType, FindTreatment, TreatmentState - +from archaeological_finds.models import ( + Find, MaterialType, Treatment, TreatmentType, FindTreatment, + TreatmentStatus, TreatmentInputStatus +) from archaeological_warehouse import models, views, forms, serializers from archaeological_operations.serializers import operation_serialization @@ -947,13 +948,16 @@ class ContainerTest(FindInit, TestCase): self.assertEqual(find.container_fisrt_full_location, full_localisation) self.assertEqual(find.container_ref_fisrt_full_location, full_localisation) - treat_state = TreatmentState.get_completed_state() + treat_input_status = TreatmentInputStatus.get_validated_state() + treat_status = TreatmentStatus.get_completed_state() + t = Treatment.objects.create( container=container_2, year=2024, start_date=datetime.date(2024, 2, 29), location=self.main_warehouse, - treatment_state=treat_state + input_status=treat_input_status, + treatment_status=treat_status, ) treat_type = TreatmentType.objects.get(txt_idx="packaging") t.treatment_types.add(treat_type) |