diff options
| -rw-r--r-- | archaeological_finds/models_finds.py | 2 | ||||
| -rw-r--r-- | archaeological_finds/tests.py | 4 | 
2 files changed, 6 insertions, 0 deletions
| diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py index 8d4c65f1a..157841ab7 100644 --- a/archaeological_finds/models_finds.py +++ b/archaeological_finds/models_finds.py @@ -1999,6 +1999,8 @@ class Find(BulkUpdatedItem, ValueGetter, DocumentItem, BaseHistorizedItem,              if bf:                  new.base_finds.add(bf.duplicate(                      user=user, data={"label": new.label, "external_id": None})) +            # remove documents for this kind of duplicate (data entry) +            new.documents.clear()          return new      @classmethod diff --git a/archaeological_finds/tests.py b/archaeological_finds/tests.py index 178a5f035..e39ebda32 100644 --- a/archaeological_finds/tests.py +++ b/archaeological_finds/tests.py @@ -1211,6 +1211,9 @@ class FindQATest(FindInit, TestCase):          default_desc = "Description for duplicate"          find.description = default_desc          find.save() +        d = Document.objects.create() +        d.finds.add(find) +          c = Client()          url = reverse('find-qa-duplicate', args=[find.pk])          response = c.get(url) @@ -1241,6 +1244,7 @@ class FindQATest(FindInit, TestCase):          new_bf = models.BaseFind.objects.order_by('-pk').all()[0]          base_bf = find.get_first_base_find()          self.assertEqual(new_bf.context_record, base_bf.context_record) +        self.assertNotIn(d, list(new.documents.all()))      def test_bulk_update(self):          c = Client() | 
