web/views/autoform.py
changeset 5557 1a534c596bff
parent 5464 c6c9a80ad1dd
child 5590 a56eb02f9ce7
equal deleted inserted replaced
5556:9ab2b4c74baf 5557:1a534c596bff
   764 
   764 
   765     def editable_attributes(self, strict=False):
   765     def editable_attributes(self, strict=False):
   766         """return a list of (relation schema, role) to edit for the entity"""
   766         """return a list of (relation schema, role) to edit for the entity"""
   767         if self.display_fields is not None:
   767         if self.display_fields is not None:
   768             return self.display_fields
   768             return self.display_fields
   769         if self.edited_entity.has_eid() and not self.edited_entity.has_perm('update'):
   769         if self.edited_entity.has_eid() and not self.edited_entity.cw_has_perm('update'):
   770             return []
   770             return []
   771         # XXX we should simply put eid in the generated section, no?
   771         # XXX we should simply put eid in the generated section, no?
   772         return [(rtype, role) for rtype, _, role in self._relations_by_section(
   772         return [(rtype, role) for rtype, _, role in self._relations_by_section(
   773             'attributes', 'update', strict)]
   773             'attributes', 'update', strict)]
   774 
   774 
   867         related = entity.has_eid() and entity.related(rschema, role)
   867         related = entity.has_eid() and entity.related(rschema, role)
   868         if related:
   868         if related:
   869             vvreg = self._cw.vreg['views']
   869             vvreg = self._cw.vreg['views']
   870             # display inline-edition view for all existing related entities
   870             # display inline-edition view for all existing related entities
   871             for i, relentity in enumerate(related.entities()):
   871             for i, relentity in enumerate(related.entities()):
   872                 if relentity.has_perm('update'):
   872                 if relentity.cw_has_perm('update'):
   873                     yield vvreg.select('inline-edition', self._cw,
   873                     yield vvreg.select('inline-edition', self._cw,
   874                                        rset=related, row=i, col=0,
   874                                        rset=related, row=i, col=0,
   875                                        etype=ttype, rtype=rschema, role=role,
   875                                        etype=ttype, rtype=rschema, role=role,
   876                                        peid=entity.eid, pform=self)
   876                                        peid=entity.eid, pform=self)
   877 
   877