web/views/autoform.py
branchstable
changeset 3358 0cddc4d8cad8
parent 3356 9ca73fbd3a58
child 3360 b02df886eb3e
equal deleted inserted replaced
3357:5aed5d6cd5d0 3358:0cddc4d8cad8
   291 
   291 
   292     def should_inline_relation_form(self, rschema, targettype, role):
   292     def should_inline_relation_form(self, rschema, targettype, role):
   293         """return true if the given relation with entity has role and a
   293         """return true if the given relation with entity has role and a
   294         targettype target should be inlined
   294         targettype target should be inlined
   295         """
   295         """
   296         return self.rinlined.etype_get(self.edited_entity.id, rschema, role, targettype)
   296         return self.rinlined.etype_get(self.edited_entity.id, rschema, role,
       
   297                                        targettype)
       
   298 
       
   299     def display_inline_edition_form(self, w, rschema, targettype, role,
       
   300                                      i18nctx):
       
   301         """display inline forms for already related entities.
       
   302 
       
   303         Return True if some inlined form are actually displayed
       
   304         """
       
   305         existant = False
       
   306         entity = self.edited_entity
       
   307         related = entity.has_eid() and entity.related(rschema, role)
       
   308         if related:
       
   309             # display inline-edition view for all existing related entities
       
   310             for i, relentity in enumerate(related.entities()):
       
   311                 if relentity.has_perm('update'):
       
   312                     w(self.view('inline-edition', related, row=i, col=0,
       
   313                                 rtype=rschema, role=role, ptype=entity.e_schema,
       
   314                                 peid=entity.eid, i18nctx=i18nctx))
       
   315                     existant = True
       
   316         return existant
   297 
   317 
   298     def should_display_inline_creation_form(self, rschema, existant, card):
   318     def should_display_inline_creation_form(self, rschema, existant, card):
   299         """return true if a creation form should be inlined
   319         """return true if a creation form should be inlined
   300 
   320 
   301         by default true if there is no related entity and we need at least one
   321         by default true if there is no related entity and we need at least one