apply on non final relation tls-sprint
authorsylvain.thenault@logilab.fr
Thu, 30 Apr 2009 12:36:48 +0200
branchtls-sprint
changeset 1579 4eea314694e2
parent 1578 73af05429cb4
child 1580 e26bbb0a6eb9
child 1601 171afa270086
apply on non final relation
web/views/editforms.py
--- a/web/views/editforms.py	Thu Apr 30 12:36:33 2009 +0200
+++ b/web/views/editforms.py	Thu Apr 30 12:36:48 2009 +0200
@@ -92,13 +92,19 @@
                 "'%(eid)s', '%(divid)s', %(reload)s);")
     ondblclick = "showInlineEditionForm(%(eid)s, '%(rtype)s', '%(divid)s')"
 
-    def cell_call(self, row, col, rtype=None, role='subject', reload=False):
+    def cell_call(self, row, col, rtype=None, role='subject', reload=False,
+                  vid='autolimited'):
         """display field to edit entity's `rtype` relation on double-click"""
+        rschema = self.schema.rschema(rtype)
         entity = self.entity(row, col)
-        if getattr(entity, rtype) is None:
-            value = self.req._('not specified')
+        if rschema.is_final():
+            if getattr(entity, rtype) is None:
+                value = self.req._('not specified')
+            else:
+                value = entity.printable_value(rtype)
         else:
-            value = entity.printable_value(rtype)
+            rset = entity.related(rtype, role)
+            value = self.view(vid, rset, 'null')
         if not entity.has_perm('update'):
             self.w(value)
             return