web/views/autoform.py
changeset 10637 a8b33789b982
parent 10634 06a43f727601
child 10646 45671fb330f5
--- a/web/views/autoform.py	Thu Oct 08 11:47:15 2015 +0200
+++ b/web/views/autoform.py	Wed Sep 09 08:32:49 2015 +0200
@@ -952,6 +952,8 @@
     def check_inlined_rdef_permissions(self, rschema, role, tschema, ttype):
         """return true if permissions are granted on the inlined object and
         relation"""
+        if not tschema.has_perm(self._cw, 'add'):
+            return False
         entity = self.edited_entity
         rdef = entity.e_schema.rdef(rschema, role, ttype)
         if entity.has_eid():
@@ -959,10 +961,8 @@
                 rdefkwargs = {'fromeid': entity.eid}
             else:
                 rdefkwargs = {'toeid': entity.eid}
-        else:
-            rdefkwargs = {}
-        return (tschema.has_perm(self._cw, 'add')
-                and rdef.has_perm(self._cw, 'add', **rdefkwargs))
+            return rdef.has_perm(self._cw, 'add', **rdefkwargs)
+        return rdef.may_have_permission('add', self._cw)
 
 
     def should_hide_add_new_relation_link(self, rschema, card):