brotherton-erpnext/erpnext/patches/v12_0/recalculate_requested_qty_in_bin.py
Ankush Menat c36bd7e1a6 fix: avoid creating bins without item-wh
Co-Authored-By:  Shadrak Gurupnor <30501401+shadrak98@users.noreply.github.com>
Co-Authored-By: Saurabh <saurabh6790@gmail.com>
2022-02-17 19:52:01 +05:30

17 lines
442 B
Python

import frappe
from erpnext.stock.stock_balance import get_indented_qty, update_bin_qty
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
update_bin_qty(entry.get("item_code"), entry.get("warehouse"), {
"indented_qty": get_indented_qty(entry.get("item_code"), entry.get("warehouse"))
})