'After DB I/O tasks for Project records'

@staticmethod
def project_project_onaccept(form):

    settings = current.deployment_settings
    if settings.get_project_multiple_organisations():
        form_vars = form.vars
        id = form_vars.id
        organisation_id = (form_vars.organisation_id or current.request.post_vars.organisation_id)
        if organisation_id:
            lead_role = settings.get_project_organisation_lead_role()
            otable = current.s3db.project_organisation
            query = ((otable.project_id == id) & (otable.role == lead_role))
            count = current.db(query).update(organisation_id=organisation_id)
            if (not count):
                oid = otable.insert(project_id=id, organisation_id=organisation_id, role=lead_role)
                current.auth.s3_set_record_owner(otable, oid)
