diff --git a/HISTORY.rst b/HISTORY.rst index 99c2ac17af..d485d9186f 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -10,6 +10,7 @@ * Add test the user managament app for database conversion. * Add support for natural keys to the DocumentPageImageCache model. * Add database conversion test to the common app. +* Fix label display for resolved smart links when not using a dynamic label. 3.1.1 (2018-09-18) ================== diff --git a/mayan/apps/linking/apps.py b/mayan/apps/linking/apps.py index 56fee57d08..aa90fa2944 100644 --- a/mayan/apps/linking/apps.py +++ b/mayan/apps/linking/apps.py @@ -54,8 +54,8 @@ class LinkingApp(MayanAppConfig): SourceColumn( source=ResolvedSmartLink, label=_('Label'), - func=lambda context: context['object'].get_dynamic_label( - context['document'] + func=lambda context: context['object'].get_label_for( + document=context['document'] ) ) diff --git a/mayan/apps/linking/models.py b/mayan/apps/linking/models.py index bc51967589..19af031945 100644 --- a/mayan/apps/linking/models.py +++ b/mayan/apps/linking/models.py @@ -93,7 +93,9 @@ class SmartLink(models.Model): def resolve_for(self, document): return ResolvedSmartLink( - smart_link=self, queryset=self.get_linked_document_for(document) + smart_link=self, queryset=self.get_linked_document_for( + document=document + ) ) @@ -101,6 +103,9 @@ class ResolvedSmartLink(SmartLink): class Meta: proxy = True + def get_label_for(self, document): + return self.get_dynamic_label(document=document) or self.label + @python_2_unicode_compatible class SmartLinkCondition(models.Model):