'Create a catalog_item for this item
Update the UM (Unit of Measure) in the supply_item_pack table'

@staticmethod
def supply_item_onaccept(form):

    db = current.db
    vars = form.vars
    item_id = vars.id
    catalog_id = vars.catalog_id
    catalog_item_id = None
    citable = db.supply_catalog_item
    query = ((citable.item_id == item_id) & (citable.deleted == False))
    rows = db(citable).select(citable.id)
    if (not len(rows)):
        catalog_item_id = citable.insert(catalog_id=catalog_id, item_category_id=vars.item_category_id, item_id=item_id)
    elif (len(rows) == 1):
        catalog_item_id = rows.first().id
        catalog_item_id = db((citable.id == catalog_item_id)).update(catalog_id=catalog_id, item_category_id=vars.item_category_id, item_id=item_id)
    um = (vars.um or db.supply_item.um.default)
    table = db.supply_item_pack
    query = (((table.item_id == item_id) & (table.quantity == 1)) & (table.deleted == False))
    if (db(query).update(name=um) == 0):
        table.insert(item_id=item_id, name=um, quantity=1)
    if vars.kit:
        url = URL(args=['[id]', 'kit_item'])
        current.s3db.configure('supply_item', create_next=url, update_next=url)
