mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-21 22:19:18 +00:00
[production] update planned and produced ty
This commit is contained in:
@@ -3,19 +3,9 @@
|
||||
|
||||
def execute():
|
||||
import webnotes
|
||||
from webnotes.utils import flt
|
||||
|
||||
for d in webnotes.conn.sql("select name, item_code, warehouse, ordered_qty from tabBin",
|
||||
as_dict=1):
|
||||
ordered_qty = webnotes.conn.sql("""
|
||||
select sum((po_item.qty - po_item.received_qty)*po_item.conversion_factor)
|
||||
from `tabPurchase Order Item` po_item, `tabPurchase Order` po
|
||||
where po_item.item_code=%s and po_item.warehouse=%s
|
||||
and po_item.qty > po_item.received_qty and po_item.parent=po.name
|
||||
and po.status!='Stopped' and po.docstatus=1""", (d.item_code, d.warehouse))
|
||||
from utilities.repost_stock import get_ordered_qty, update_bin
|
||||
|
||||
if flt(d.ordered_qty) != flt(ordered_qty[0][0]):
|
||||
webnotes.conn.set_value("Bin", d.name, "ordered_qty", flt(ordered_qty[0][0]))
|
||||
|
||||
webnotes.conn.sql("""update tabBin set projected_qty = actual_qty + planned_qty +
|
||||
indented_qty + ordered_qty - reserved_qty where name = %s""", d.name)
|
||||
for d in webnotes.conn.sql("select item_code, warehouse from tabBin"):
|
||||
update_bin(d[0], d[1], {
|
||||
"ordered_qty": get_ordered_qty(d[0], d[1])
|
||||
})
|
||||
Reference in New Issue
Block a user