'After DB I/O'

@staticmethod
def asset_onaccept(form):

    if current.response.s3.bulk:
        return
    db = current.db
    atable = db.asset_asset
    form_vars = form.vars
    kit = form_vars.get('kit', None)
    site_id = form_vars.get('site_id', None)
    if site_id:
        stable = db.org_site
        asset_id = form_vars.id
        location_id = db((stable.site_id == site_id)).select(stable.location_id, limitby=(0, 1)).first().location_id
        tracker = S3Tracker()
        asset_tracker = tracker(atable, asset_id)
        asset_tracker.set_base_location(location_id)
        if kit:
            aitable = db.asset_item
            db((aitable.asset_id == asset_id)).update(location_id=location_id)
        ltable = db.asset_log
        ltable.insert(asset_id=asset_id, status=ASSET_LOG_SET_BASE, organisation_id=form_vars.get('organisation_id', None), site_id=site_id, cond=1)
    if kit:
        db((atable.id == asset_id)).update(supplier_org_id=None, purchase_date=None, purchase_price=None, purchase_currency=None)
    else:
        aitable = db.asset_item
        ids = db((aitable.asset_id == asset_id)).select(aitable.id).as_list()
        if ids:
            resource = current.s3db.resource('asset_item', id=ids)
            resource.delete()
    return
