brotherton-erpnext/erpnext/patches/v6_0/fix_planned_qty.py
Zarrar 13ddc7e188 [ Enhance ] Production to Work Order (#12902)
* remove occurrences of Production Order

* rename from report and jsons

* Change Production Order to Work Order

* change occurences of production order from other files

* resolve minor conflict issues and reports

* patch added

* codacy fix

* updated patches, leftover changes

* rename reports, rectify patches
2018-03-20 12:38:43 +05:30

15 lines
589 B
Python

# 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.stock.stock_balance import get_planned_qty, update_bin_qty
def execute():
for item_code, warehouse in frappe.db.sql("""select distinct production_item, fg_warehouse
from `tabWork Order`"""):
if frappe.db.exists("Item", item_code) and frappe.db.exists("Warehouse", warehouse):
update_bin_qty(item_code, warehouse, {
"planned_qty": get_planned_qty(item_code, warehouse)
})