diff options
Diffstat (limited to 'archaeological_finds')
-rw-r--r-- | archaeological_finds/models_finds.py | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py index d825a8bb2..303d8e2b4 100644 --- a/archaeological_finds/models_finds.py +++ b/archaeological_finds/models_finds.py @@ -631,12 +631,18 @@ class BaseFind( return self._real_label() or self._temp_label() or "" def material_type_label(self): - find = self.get_last_find() - finds = [find and find.material_type.code or ""] - ope = self.context_record.operation - finds += [ope.code_patriarche or (str(ope.year) + "-" + ope.operation_code)] - finds += [self.context_record.label, str(self.material_index)] - return settings.JOINT.join(finds) + materials = set() + for f in self.find.all(): + for m in f.material_types.all(): + while m: + if m.code: + materials.add(m.code) + break + elif m.parent: + m = m.parent + else: + break + return "-".join(materials) def _real_label(self): if ( |