From eb9d989822c4314bb36d2b8179a598c8b9f2b9c9 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 19 Nov 2018 10:17:06 +0100 Subject: Treatment n<->1: copy and merge data --- archaeological_finds/models_treatments.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'archaeological_finds') diff --git a/archaeological_finds/models_treatments.py b/archaeological_finds/models_treatments.py index c7b888c0d..d92c98235 100644 --- a/archaeological_finds/models_treatments.py +++ b/archaeological_finds/models_treatments.py @@ -34,7 +34,8 @@ from ishtar_common.models import Document, GeneralType, \ ImageModel, BaseHistorizedItem, OwnPerms, HistoricalRecords, Person, \ Organization, ValueGetter, post_save_cache, ShortMenuItem, \ DashboardFormItem, ExternalIdManager -from ishtar_common.utils import cached_label_changed, get_current_year +from ishtar_common.utils import cached_label_changed, get_current_year, \ + update_data class TreatmentState(GeneralType): @@ -351,6 +352,10 @@ class Treatment(DashboardFormItem, ValueGetter, BaseHistorizedItem, current_documents.append(document.pk) new_find.documents.add(document) + # data + new_find.data = update_data(new_find.data, upstream_item.data, + merge=True) + upstream_item.downstream_treatment = self upstream_item.history_modifier = self.history_modifier upstream_item.save() -- cgit v1.2.3