diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2024-10-09 12:40:46 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2024-10-09 12:40:46 +0200 |
commit | cb7cd51fa542732b867c67aa406ac996a8d2ae0d (patch) | |
tree | c73a5d0b66081516f30059d727f39cf649db3929 /archaeological_operations/wizards.py | |
parent | 6af72c2f8c14f3693305bd616fd244345b24c25e (diff) | |
download | Ishtar-cb7cd51fa542732b867c67aa406ac996a8d2ae0d.tar.bz2 Ishtar-cb7cd51fa542732b867c67aa406ac996a8d2ae0d.zip |
🐛 archaeological files - on operation creation report address and
locality (refs #6045)
Diffstat (limited to 'archaeological_operations/wizards.py')
-rw-r--r-- | archaeological_operations/wizards.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/archaeological_operations/wizards.py b/archaeological_operations/wizards.py index e70eea676..ac8aaf40d 100644 --- a/archaeological_operations/wizards.py +++ b/archaeological_operations/wizards.py @@ -162,32 +162,37 @@ class OperationWizard(Wizard): value = c_value if not value: continue - initial[dest_key] = value + if initial.get(dest_key, None): + initial[dest_key] += "\n" + value + else: + initial[dest_key] = value return initial def _copy_from_associated_field(self): initial = {} - file = self.get_current_file() - if not file: + current_file = self.get_current_file() + if not current_file: return initial keys = ( (("in_charge", "pk"), "in_charge"), (("operation_name",), "common_name"), (("total_surface",), "surface"), + (("locality",), "address"), + (("address",), "address"), ) - initial.update(self.__copy_fields(file, keys)) + initial.update(self.__copy_fields(current_file, keys)) if not initial.get("common_name", None): - initial["common_name"] = file.name or "" + initial["common_name"] = current_file.name or "" if "town" not in initial: initial["town"] = [idx for idx, __ in self.get_towns()] - if file.is_preventive(): + if current_file.is_preventive(): return initial keys = ( (("scientist", "pk"), "scientist"), (("requested_operation_type", "pk"), "operation_type"), (("organization", "pk"), "operator"), ) - initial.update(self.__copy_fields(file, keys)) + initial.update(self.__copy_fields(current_file, keys)) return initial |