diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 3e4bc81a12..820403706c 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -94,3 +94,4 @@ erpnext.patches.v4_2.discount_amount erpnext.patches.v4_2.update_landed_cost_voucher erpnext.patches.v4_2.set_item_has_batch erpnext.patches.v4_2.update_stock_uom_for_dn_in_sle +erpnext.patches.v4_2.repost_reserved_qty \ No newline at end of file diff --git a/erpnext/patches/v4_2/repost_reserved_qty.py b/erpnext/patches/v4_2/repost_reserved_qty.py new file mode 100644 index 0000000000..04dfb77bfa --- /dev/null +++ b/erpnext/patches/v4_2/repost_reserved_qty.py @@ -0,0 +1,12 @@ +# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import frappe +from erpnext.utilities.repost_stock import update_bin_qty, get_reserved_qty + +def execute(): + for item_code, warehouse in frappe.db.sql("select item_code, warehouse from tabBin where ifnull(reserved_qty, 0) < 0"): + update_bin_qty(item_code, warehouse, { + "reserved_qty": get_reserved_qty(item_code, warehouse) + }) \ No newline at end of file