diff options
| -rw-r--r-- | archaeological_finds/models_treatments.py | 8 | 
1 files changed, 8 insertions, 0 deletions
| diff --git a/archaeological_finds/models_treatments.py b/archaeological_finds/models_treatments.py index 4e2eb0faf..c7b888c0d 100644 --- a/archaeological_finds/models_treatments.py +++ b/archaeological_finds/models_treatments.py @@ -317,6 +317,7 @@ class Treatment(DashboardFormItem, ValueGetter, BaseHistorizedItem,                         "quality", "precise_dating"]          current_datings = []          current_base_finds = [] +        current_documents = []          for upstream_item in upstream_items:              # datings are not explicitly part of the resulting_find              # need to reassociate with no duplicate @@ -343,6 +344,13 @@ class Treatment(DashboardFormItem, ValueGetter, BaseHistorizedItem,                  current_base_finds.append(base_find.pk)                  new_find.base_finds.add(base_find) +            # documents +            for document in upstream_item.documents.all(): +                if document.pk in current_documents: +                    continue +                current_documents.append(document.pk) +                new_find.documents.add(document) +              upstream_item.downstream_treatment = self              upstream_item.history_modifier = self.history_modifier              upstream_item.save() | 
