Beispiel #1
0
def warehouse_update(warehouse_id):
    warehouse = Warehouse.get_by_id(warehouse_id)
    warehouse.location = request.form.get("warehouse_location")
    if warehouse.save():
        flash("Warehouse location successfully updated.", "success")
    else:
        flash("The location entered is same as the previous", "danger")
    return redirect(url_for('warehouse_show', warehouse_id=warehouse.id))
Beispiel #2
0
def warehouse_delete(id):
    del_wh = Warehouse.get_by_id(id)
    prod_checking = Product.get_or_none(Product.warehouse_id == del_wh)

    if prod_checking:
        prod_checking.delete().where(
            Product.warehouse_id == prod_checking.warehouse_id).execute()

    if del_wh.delete_instance():
        flash('Successfully deleted!', 'success')
    else:
        flash('Something went wrong, check your internet and try again',
              'danger')

    return redirect(url_for('warehouses_list'))
Beispiel #3
0
def warehouse_show(id):
    sel_wh = Warehouse.get_by_id(id)
    return render_template('warehouse_show.html', sel_wh=sel_wh)
Beispiel #4
0
def warehouse_delete(warehouse_id):
    warehouse = Warehouse.get_by_id(warehouse_id)
    if warehouse.delete_instance():
        flash("Warehouse successfull deleted.", "success")
    return redirect(url_for('warehouse_index'))
Beispiel #5
0
def warehouse_show(warehouse_id):
    warehouse = Warehouse.get_by_id(warehouse_id)
    return render_template('warehouse_show.html', warehouse=warehouse)