def project_activity_postprocess(form):
 form_vars = form.vars
 project_id = form_vars.get('project_id', None)
 if project_id:
  s3db = current.s3db
  db = current.db
  activity_id = form_vars.get('id', None)
  ltable = s3db.project_activity_organisation
  org = db((ltable.activity_id == activity_id)).select(ltable.organisation_id, limitby=(0, 1)).first()
  if org:
   return
  ptable = s3db.project_project
  project = db((ptable.id == project_id)).select(ptable.organisation_id, limitby=(0, 1)).first()
  try:
   organisation_id = project.organisation_id
  except:
   return
  ltable.insert(activity_id=activity_id, organisation_id=organisation_id)

def project_activity_postprocess ( form ) : form_vars = form . vars project_id = form_vars . get ( 'project_id' , None ) if project_id : s3db = current . s3db db = current . db activity_id = form_vars . get ( 'id' , None ) ltable = s3db . project_activity_organisation org = db ( ( ltable . activity_id == activity_id ) ) . select ( ltable . organisation_id , limitby = ( 0 , 1 ) ) . first ( ) if org : return ptable = s3db . project_project project = db ( ( ptable . id == project_id ) ) . select ( ptable . organisation_id , limitby = ( 0 , 1 ) ) . first ( ) try : organisation_id = project . organisation_id except : return ltable . insert ( activity_id = activity_id , organisation_id = organisation_id )
default the activitys organisation to that of the project .