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
commit9ec4e271f9285fb7cd8d735c859decaa9c0d2673 (patch)
treee86de03a208f0583ed57159e4fe12ecf264efea4 /archaeological_warehouse/management/commands/migrate_to_new_container_management.py
parent311a4addb62dc4dac5a6fee7c2097a118acb9a8e (diff)
downloadIshtar-9ec4e271f9285fb7cd8d735c859decaa9c0d2673.tar.bz2
Ishtar-9ec4e271f9285fb7cd8d735c859decaa9c0d2673.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,