From f44bca5141fa5b3f59ee6bf237778749451e2e15 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 15 May 2023 17:33:49 +0200 Subject: 🐛 recalculate container weight on find remove (refs #5470) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- archaeological_warehouse/tests.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'archaeological_warehouse') diff --git a/archaeological_warehouse/tests.py b/archaeological_warehouse/tests.py index 54432f9a5..ebea75217 100644 --- a/archaeological_warehouse/tests.py +++ b/archaeological_warehouse/tests.py @@ -1177,11 +1177,22 @@ class ContainerTest(FindInit, TestCase): self.assertEqual(container_1.calculated_weight, 1500) self.assertEqual(container_1.cached_weight, 1500) + container_2 = models.Container.objects.create( + reference="Test 2", location=self.main_warehouse, container_type=ct + ) + find2.container = container_2 + find2.save() + container_1 = models.Container.objects.get(pk=container_1.pk) + self.assertEqual(container_1.calculated_weight, 800) + self.assertEqual(container_1.cached_weight, 800) + profile, created = IshtarSiteProfile.objects.get_or_create( slug="default", active=True ) profile.calculate_weight_on_full = True profile.save() + find2.container = container_1 + find2.save() container_1.save() container_1 = models.Container.objects.get(pk=container_1.pk) -- cgit v1.2.3