cubicweb/web/views/autoform.py
changeset 11129 97095348b3ee
parent 11100 5758ba784ebd
parent 11057 0b59724cb3f2
child 11151 4259c55df3e7
--- a/cubicweb/web/views/autoform.py	Thu Feb 11 21:59:49 2016 +0100
+++ b/cubicweb/web/views/autoform.py	Wed Feb 17 13:45:34 2016 +0100
@@ -899,14 +899,13 @@
             ttype = tschema.type
             formviews = list(self.inline_edition_form_view(rschema, ttype, role))
             card = rschema.role_rdef(entity.e_schema, ttype, role).role_cardinality(role)
-            # there is no related entity and we need at least one: we need to
-            # display one explicit inline-creation view
-            if self.should_display_inline_creation_form(rschema, formviews, card):
+            related = entity.has_eid() and entity.related(rschema, role)
+            if self.should_display_inline_creation_form(rschema, related, card):
                 formviews += self.inline_creation_form_view(rschema, ttype, role)
             # we can create more than one related entity, we thus display a link
             # to add new related entities
             if self.must_display_add_new_relation_link(rschema, role, tschema,
-                                                       ttype, formviews, card):
+                                                       ttype, related, card):
                 addnewlink = self._cw.vreg['views'].select(
                     'inline-addnew-link', self._cw,
                     etype=ttype, rtype=rschema, role=role, card=card,