'Used in site REST controllers to Filter out items which are
already in this inventory'

@staticmethod
def inv_prep(r):

    if r.component:
        if (r.component.name == 'inv_item'):
            db = current.db
            table = db.inv_inv_item
            query = ((table.site_id == r.record.site_id) & (table.deleted == False))
            inv_item_rows = db(query).select(table.item_id)
            item_ids = [row.item_id for row in inv_item_rows]
            if (r.method == 'update'):
                item = db((table.id == r.args[2])).select(table.item_id, limitby=(0, 1)).first()
                item_ids.remove(item.item_id)
            table.item_id.requires.set_filter(not_filterby='id', not_filter_opts=item_ids)
        elif (r.component.name == 'send'):
            current.response.s3.gis.tab = 'search'
