diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2020-10-01 03:56:35 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-02-28 12:15:20 +0100 |
commit | b32c94e91ba0195eab52f6ea4512845be94a3cba (patch) | |
tree | 2ad4db00c989723b0d6c4cb2662f35b349597be7 /archaeological_warehouse/models.py | |
parent | b4d3b7d7d8a994f636c16697f245ac14d7a3f547 (diff) | |
download | Ishtar-b32c94e91ba0195eab52f6ea4512845be94a3cba.tar.bz2 Ishtar-b32c94e91ba0195eab52f6ea4512845be94a3cba.zip |
Sheet: document tab for container, warehouse and file
Diffstat (limited to 'archaeological_warehouse/models.py')
-rw-r--r-- | archaeological_warehouse/models.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/archaeological_warehouse/models.py b/archaeological_warehouse/models.py index f89092dba..b32d608af 100644 --- a/archaeological_warehouse/models.py +++ b/archaeological_warehouse/models.py @@ -1290,13 +1290,14 @@ class Container(DocumentItem, Merge, LightHistorizedItem, QRCodeItem, GeoItem, q = Container.objects if q.count(): self.index = int( - q.aggregate(Max("index"))["index__max"] or 0) + 1 + q.all().aggregate(Max("index"))["index__max"] or 0) + 1 else: self.index = 1 - elif self.responsible_id: # default is index by warehouse - q = Container.objects.filter(responsible=self.responsible) + else: # default is index by warehouse + q = Container.objects.filter(location=self.location) if q.count(): - self.index = int(q.aggregate(Max("index"))["index__max"]) + 1 + self.index = int( + q.all().aggregate(Max("index"))["index__max"]) + 1 else: self.index = 1 |