web/views/autoform.py
changeset 6394 eb9a5bd778bc
parent 6101 1aff7367a20c
child 6401 d7f5d873e1b8
--- a/web/views/autoform.py	Mon Oct 04 18:59:32 2010 +0200
+++ b/web/views/autoform.py	Tue Oct 05 08:33:10 2010 +0200
@@ -826,40 +826,30 @@
                              'dunno what to do', rschema)
                 continue
             ttype = ttypes[0].type
-            if self.should_inline_relation_form(rschema, ttype, role):
-                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):
-                    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.should_display_add_new_relation_link(rschema, formviews, card):
-                    addnewlink = self._cw.vreg['views'].select(
-                        'inline-addnew-link', self._cw,
-                        etype=ttype, rtype=rschema, role=role, card=card,
-                        peid=self.edited_entity.eid,
-                        petype=self.edited_entity.e_schema, pform=self)
-                    formviews.append(addnewlink)
-                allformviews += formviews
+            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):
+                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.should_display_add_new_relation_link(rschema, formviews, card):
+                addnewlink = self._cw.vreg['views'].select(
+                    'inline-addnew-link', self._cw,
+                    etype=ttype, rtype=rschema, role=role, card=card,
+                    peid=self.edited_entity.eid,
+                    petype=self.edited_entity.e_schema, pform=self)
+                formviews.append(addnewlink)
+            allformviews += formviews
         return allformviews
 
-    def should_inline_relation_form(self, rschema, targettype, role):
-        """return true if the given relation with entity has role and a
-        targettype target should be inlined
-
-        At this point we now relation has inlined_attributes tag (eg is returned
-        by `inlined_relations()`. Overrides this for more finer control.
-        """
-        return True
-
     def should_display_inline_creation_form(self, rschema, existant, card):
         """return true if a creation form should be inlined
 
         by default true if there is no related entity and we need at least one
         """
-        return not existant and card in '1+' or self._cw.form.has_key('force_%s_display' % rschema)
+        return not existant and card in '1+'
 
     def should_display_add_new_relation_link(self, rschema, existant, card):
         """return true if we should add a link to add a new creation form