diff options
-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 |