def skills_filter(req_id):
 rstable = s3db.req_req_skill
 rows = db((rstable.req_id == req_id)).select(rstable.skill_id)
 filter_opts = []
 for r in rows:
  multi_skill_id = r.skill_id
  for skill_id in multi_skill_id:
   filter_opts.append(skill_id)
 if (len(filter_opts) == 1):
  field = s3db.req_commit_skill.skill_id
  field.default = skill_id
  field.writable = False
  return
 s3db.req_commit_skill.skill_id.requires = IS_ONE_OF(db, 'hrm_skill.id', s3db.hrm_multi_skill_represent, filterby='id', filter_opts=filter_opts, sort=True, multiple=True)

def skills_filter ( req_id ) : rstable = s3db . req_req_skill rows = db ( ( rstable . req_id == req_id ) ) . select ( rstable . skill_id ) filter_opts = [ ] for r in rows : multi_skill_id = r . skill_id for skill_id in multi_skill_id : filter_opts . append ( skill_id ) if ( len ( filter_opts ) == 1 ) : field = s3db . req_commit_skill . skill_id field . default = skill_id field . writable = False return s3db . req_commit_skill . skill_id . requires = IS_ONE_OF ( db , 'hrm_skill.id' , s3db . hrm_multi_skill_represent , filterby = 'id' , filter_opts = filter_opts , sort = True , multiple = True )
limit commit skills to skills from the request - dry helper function .