'Update detection for inv_inv_item
@param item: the S3ImportItem'

@staticmethod
def inv_item_duplicate(item):

    table = item.table
    data = item.data
    site_id = data.get('site_id')
    item_id = data.get('item_id')
    pack_id = data.get('item_pack_id')
    owner_org_id = data.get('owner_org_id')
    supply_org_id = data.get('supply_org_id')
    pack_value = data.get('pack_value')
    currency = data.get('currency')
    bin = data.get('bin')
    query = ((((((((table.site_id == site_id) & (table.item_id == item_id)) & (table.item_pack_id == pack_id)) & (table.owner_org_id == owner_org_id)) & (table.supply_org_id == supply_org_id)) & (table.pack_value == pack_value)) & (table.currency == currency)) & (table.bin == bin))
    duplicate = current.db(query).select(table.id, table.quantity, limitby=(0, 1)).first()
    if duplicate:
        item.id = duplicate.id
        item.method = item.METHOD.UPDATE
        if (('quantity' in data) and (data.quantity == 0)):
            item.data.quantity = duplicate.quantity
