web/views/editforms.py
changeset 5557 1a534c596bff
parent 5424 8ecbcbff9777
child 5590 a56eb02f9ce7
equal deleted inserted replaced
5556:9ab2b4c74baf 5557:1a534c596bff
   204                             self.copying.eid)
   204                             self.copying.eid)
   205         for rschema, role in form.editable_attributes():
   205         for rschema, role in form.editable_attributes():
   206             if not rschema.final:
   206             if not rschema.final:
   207                 # ensure relation cache is filed
   207                 # ensure relation cache is filed
   208                 rset = self.copying.related(rschema, role)
   208                 rset = self.copying.related(rschema, role)
   209                 self.newentity.set_related_cache(rschema, role, rset)
   209                 self.newentity.cw_set_relation_cache(rschema, role, rset)
   210 
   210 
   211     def submited_message(self):
   211     def submited_message(self):
   212         """return the message that will be displayed on successful edition"""
   212         """return the message that will be displayed on successful edition"""
   213         return self._cw._('entity copied')
   213         return self._cw._('entity copied')
   214 
   214 
   340     def should_edit_attribute(self, entity, rschema, form):
   340     def should_edit_attribute(self, entity, rschema, form):
   341         rtype = str(rschema)
   341         rtype = str(rschema)
   342         rdef = entity.e_schema.rdef(rtype)
   342         rdef = entity.e_schema.rdef(rtype)
   343         afs = uicfg.autoform_section.etype_get(
   343         afs = uicfg.autoform_section.etype_get(
   344             entity.__regid__, rtype, 'subject', rdef.object)
   344             entity.__regid__, rtype, 'subject', rdef.object)
   345         if 'main_hidden' in afs or not entity.has_perm('update'):
   345         if 'main_hidden' in afs or not entity.cw_has_perm('update'):
   346             return False
   346             return False
   347         if not rdef.has_perm(self._cw, 'update', eid=entity.eid):
   347         if not rdef.has_perm(self._cw, 'update', eid=entity.eid):
   348             return False
   348             return False
   349         try:
   349         try:
   350             form.field_by_name(rtype, 'subject', entity.e_schema)
   350             form.field_by_name(rtype, 'subject', entity.e_schema)