summaryrefslogtreecommitdiff
path: root/archaeological_warehouse/management/commands/migrate_to_new_container_management.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2021-01-21 17:50:51 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2021-02-28 12:15:23 +0100
commit8d7ed2a8208a1d3422e4827a35fa7d6cb7f59cee (patch)
treee86de03a208f0583ed57159e4fe12ecf264efea4 /archaeological_warehouse/management/commands/migrate_to_new_container_management.py
parente4782f904c34e78e551093010d062e19a92d4833 (diff)
downloadIshtar-8d7ed2a8208a1d3422e4827a35fa7d6cb7f59cee.tar.bz2
Ishtar-8d7ed2a8208a1d3422e4827a35fa7d6cb7f59cee.zip
Fix migration of new containers - add collection field
Diffstat (limited to 'archaeological_warehouse/management/commands/migrate_to_new_container_management.py')
-rw-r--r--archaeological_warehouse/management/commands/migrate_to_new_container_management.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/archaeological_warehouse/management/commands/migrate_to_new_container_management.py b/archaeological_warehouse/management/commands/migrate_to_new_container_management.py
index 24ec078bf..38cabd842 100644
--- a/archaeological_warehouse/management/commands/migrate_to_new_container_management.py
+++ b/archaeological_warehouse/management/commands/migrate_to_new_container_management.py
@@ -76,8 +76,8 @@ class Command(BaseCommand):
parent=parent,
container_type=container_types[
division.division.division_id],
- location=container.responsible,
- responsible=container.responsible)
+ location=container.location,
+ responsible=container.location)
if created:
created_nb += 1
ref = "{} || {}".format(str(new_container.container_type),
@@ -89,6 +89,9 @@ class Command(BaseCommand):
potential_duplicate[container.responsible_id][
ref].append(division.reference.strip())
parent = new_container
+ if container.collection_id != container.responsible_id:
+ container.collection_id = container.responsible_id
+ container.save()
if parent:
q = models.Container.objects.filter(
location=container.location,