# HG changeset patch # User Sylvain Thénault # Date 1281457603 -7200 # Node ID 887c069d88df3023b114b2e10219c4b4ec6c0cfe # Parent 28f49a4fe702cdc3c83edb4a1fc7566889de7a68 [primary] backport _rel_label method from the default branch diff -r 28f49a4fe702 -r 887c069d88df web/views/primary.py --- a/web/views/primary.py Tue Aug 10 14:56:31 2010 +0200 +++ b/web/views/primary.py Tue Aug 10 18:26:43 2010 +0200 @@ -271,6 +271,19 @@ label = display_name(self._cw, rschema.type, role) self.field(label, value, show_label=showlabel, tr=False, table=table) + def _rel_label(self, entity, rschema, role, dispctrl): + if rschema.final: + showlabel = dispctrl.get('showlabel', self.show_attr_label) + else: + showlabel = dispctrl.get('showlabel', self.show_rel_label) + if showlabel: + if dispctrl.get('label'): + label = self._cw._(dispctrl['label']) + else: + label = display_name(self._cw, rschema.type, role, + context=entity.__regid__) + return label + return u'' class RelatedView(EntityView): __regid__ = 'autolimited'