2015-09-09 05:34:05 +00:00
|
|
|
# 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():
|
2015-09-09 12:29:48 +00:00
|
|
|
for item_code, warehouse in frappe.db.sql("""select distinct production_item, fg_warehouse
|
2015-09-09 05:34:05 +00:00
|
|
|
from `tabProduction Order`"""):
|
2015-09-09 12:29:48 +00:00
|
|
|
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)
|
|
|
|
})
|