diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2025-09-16 14:24:56 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2025-09-16 17:32:03 +0200 |
commit | e295d2e5e6f62a722c42d08f6156d5a785264420 (patch) | |
tree | d5ec8afdf6df5eeeb8b0ac0318f5fae93557a1a2 /archaeological_finds/models_finds.py | |
parent | f0634c7b720cc8813ec738efe84e10cb2b309387 (diff) | |
download | Ishtar-e295d2e5e6f62a722c42d08f6156d5a785264420.tar.bz2 Ishtar-e295d2e5e6f62a722c42d08f6156d5a785264420.zip |
🐛 base find: on associated find label change, if only one base find change base find label
Diffstat (limited to 'archaeological_finds/models_finds.py')
-rw-r--r-- | archaeological_finds/models_finds.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py index 07c09bde2..09387e1a5 100644 --- a/archaeological_finds/models_finds.py +++ b/archaeological_finds/models_finds.py @@ -3701,11 +3701,15 @@ class Find( if changed: self._cached_label_checked = False self.save() + bf_nb = self.base_finds.count() for base_find in self.base_finds.filter( context_record__operation__pk__isnull=False ).all(): + # initialize / modify base find attributes modified = False - if self.label and not base_find.label: + if self.label and (not base_find.label or + (bf_nb == 1 and base_find.label != self.label)): + # change label of base find if label not provided or only one base find base_find.label = self.label modified = True if not base_find.index: |