[forms/inline] fix #703911: add new link disappears if inline box removed. Since we've the information, we must specify the target type else we get random cardinality on ambiguous relations stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 18 Feb 2010 10:57:50 +0100
branchstable
changeset 4626 c26b4df9fc90
parent 4625 d8c3a50a8ee7
child 4627 54de0ddd0bf3
[forms/inline] fix #703911: add new link disappears if inline box removed. Since we've the information, we must specify the target type else we get random cardinality on ambiguous relations
web/views/autoform.py
--- a/web/views/autoform.py	Thu Feb 18 10:55:41 2010 +0100
+++ b/web/views/autoform.py	Thu Feb 18 10:57:50 2010 +0100
@@ -175,7 +175,9 @@
     @property
     def removejs(self):
         entity = self._entity()
-        card = entity.e_schema.rdef(self.rtype, neg_role(self.role)).role_cardinality(self.role)
+        ttype = self._cw.entity_from_eid(self.peid).__regid__
+        rdef = entity.e_schema.rdef(self.rtype, neg_role(self.role), ttype)
+        card= rdef.role_cardinality(self.role)
         # when one is adding an inline entity for a relation of a single card,
         # the 'add a new xxx' link disappears. If the user then cancel the addition,
         # we have to make this link appears back. This is done by giving add new link