brotherton-erpnext/erpnext/patches/v12_0/recalculate_requested_qty_in_bin.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

22 lines
458 B
Python
Raw Normal View History

2020-03-26 09:19:28 +00:00
import frappe
2020-03-26 09:19:28 +00:00
from erpnext.stock.stock_balance import get_indented_qty, update_bin_qty
2020-03-26 09:19:28 +00:00
def execute():
bin_details = frappe.db.sql(
"""
SELECT item_code, warehouse
FROM `tabBin`""",
as_dict=1,
)
for entry in bin_details:
if not (entry.item_code and entry.warehouse):
continue
2020-03-26 09:19:28 +00:00
update_bin_qty(
entry.get("item_code"),
entry.get("warehouse"),
{"indented_qty": get_indented_qty(entry.get("item_code"), entry.get("warehouse"))},
)