def return_process():

    try:
        send_id = request.args[0]
    except:
        redirect(f="send")

    stable = s3db.inv_send
    if not auth.s3_has_permission("update", stable, record_id=send_id):
        session.error = T("You do not have permission to return this sent shipment.")

    send_record = db(stable.id == send_id).select(stable.status,
                                                  limitby=(0, 1)
                                                  ).first()
    inv_ship_status = s3db.inv_ship_status
    if send_record.status != inv_ship_status["RETURNING"]:
        session.error = T("This shipment has not been returned.")

    if session.error:
        redirect(URL(c="inv", f="send",
                     args=[send_id]))

    invtable = s3db.inv_inv_item
    rtable = s3db.inv_recv
    tracktable = s3db.inv_track_item

    # Okay no error so far, let's move the goods back into the warehouse
    # and then change the status to received
    # Update Receive record & lock for editing
    # Move each item to the site
    track_rows = db(tracktable.send_id == send_id).select(tracktable.id,
                                                          tracktable.quantity,
                                                          tracktable.return_quantity,
                                                          tracktable.send_inv_item_id,
                                                          )
    for track_item in track_rows:
        send_inv_id = track_item.send_inv_item_id
        return_qnty = track_item.return_quantity
        if return_qnty == None:
            return_qnty = 0
        # update the receive quantity in the tracking record
        tracktable[track_item.id] = dict(recv_quantity = track_item.quantity - return_qnty)
        if return_qnty:
            db(invtable.id == send_inv_id).update(quantity = invtable.quantity + return_qnty)


    stable[send_id] = dict(status = inv_ship_status["RECEIVED"],
                           owned_by_user = None,
                           owned_by_group = ADMIN)
    recv_row = db(tracktable.send_id == send_id).select(tracktable.recv_id,
                                                        limitby = (0, 1)).first()
    if recv_row:
        recv_id = recv_row.recv_id
        rtable[recv_id] = dict(date = request.utcnow,
                               status = inv_ship_status["RECEIVED"],
                               owned_by_user = None,
                               owned_by_group = ADMIN)

    # Change the status for all track items in this shipment to Received
    db(tracktable.send_id == send_id).update(status = s3db.inv_tracking_status["RECEIVED"])

    redirect(URL(f = "send",
                 args = [send_id]))

# -----------------------------------------------------------------------------
List all PTR records configured for the specified Cloud Server.
dataset/ETHPy150Open sahana/eden/controllers/inv.py/return_process--crossover with--dataset/ETHPy150Open kwminnick/rackspace-dns-cli/dnsclient/v1_0/shell.py/do_rdns_list