fix: update reserved qty for production/ s/c
(cherry picked from commit 0a15334464)
This commit is contained in:
committed by
mergify-bot
parent
f99f537b57
commit
2b868e7f56
@@ -6,8 +6,8 @@ from erpnext.stock.stock_balance import (
|
|||||||
get_ordered_qty,
|
get_ordered_qty,
|
||||||
get_planned_qty,
|
get_planned_qty,
|
||||||
get_reserved_qty,
|
get_reserved_qty,
|
||||||
update_bin_qty,
|
|
||||||
)
|
)
|
||||||
|
from erpnext.stock.utils import get_bin
|
||||||
|
|
||||||
|
|
||||||
def execute():
|
def execute():
|
||||||
@@ -32,10 +32,12 @@ def delete_and_patch_duplicate_bins():
|
|||||||
""", as_dict=1)
|
""", as_dict=1)
|
||||||
|
|
||||||
for duplicate_bin in duplicate_bins:
|
for duplicate_bin in duplicate_bins:
|
||||||
|
item_code = duplicate_bin.item_code
|
||||||
|
warehouse = duplicate_bin.warehouse
|
||||||
existing_bins = frappe.get_list("Bin",
|
existing_bins = frappe.get_list("Bin",
|
||||||
filters={
|
filters={
|
||||||
"item_code": duplicate_bin.item_code,
|
"item_code": item_code,
|
||||||
"warehouse": duplicate_bin.warehouse
|
"warehouse": warehouse
|
||||||
},
|
},
|
||||||
fields=["name"],
|
fields=["name"],
|
||||||
order_by="creation",)
|
order_by="creation",)
|
||||||
@@ -47,11 +49,15 @@ def delete_and_patch_duplicate_bins():
|
|||||||
frappe.delete_doc("Bin", broken_bin.name)
|
frappe.delete_doc("Bin", broken_bin.name)
|
||||||
|
|
||||||
qty_dict = {
|
qty_dict = {
|
||||||
"reserved_qty": get_reserved_qty(duplicate_bin.item_code, duplicate_bin.warehouse),
|
"reserved_qty": get_reserved_qty(item_code, warehouse),
|
||||||
"indented_qty": get_indented_qty(duplicate_bin.item_code, duplicate_bin.warehouse),
|
"indented_qty": get_indented_qty(item_code, warehouse),
|
||||||
"ordered_qty": get_ordered_qty(duplicate_bin.item_code, duplicate_bin.warehouse),
|
"ordered_qty": get_ordered_qty(item_code, warehouse),
|
||||||
"planned_qty": get_planned_qty(duplicate_bin.item_code, duplicate_bin.warehouse),
|
"planned_qty": get_planned_qty(item_code, warehouse),
|
||||||
"actual_qty": get_balance_qty_from_sle(duplicate_bin.item_code, duplicate_bin.warehouse)
|
"actual_qty": get_balance_qty_from_sle(item_code, warehouse)
|
||||||
}
|
}
|
||||||
|
|
||||||
update_bin_qty(duplicate_bin.item_code, duplicate_bin.warehouse, qty_dict)
|
bin = get_bin(item_code, warehouse)
|
||||||
|
bin.update(qty_dict)
|
||||||
|
bin.update_reserved_qty_for_production()
|
||||||
|
bin.update_reserved_qty_for_sub_contracting()
|
||||||
|
bin.db_update()
|
||||||
|
|||||||
Reference in New Issue
Block a user