mirror of
https://github.com/frappe/erpnext.git
synced 2026-07-29 07:28:17 +00:00
fix: exclude transferred_qty from work order item to pick list item mapping
get_mapped_doc copies same-named fields by default. work order item's transferred_qty (cumulative across the whole work order) was leaking into the new pick list item's transferred_qty (meant to track how much of that pick list row has been converted into a stock entry, starting at 0). the leaked value then got subtracted again in get_pending_transfer_stock_qty(), so every pick list after the first under-transferred raw materials by whatever was already recorded on the work order, driving material_transferred_for_manufacturing towards zero across repeated partial pick-list/finish cycles. backport of #57253 fixes #57236, related to #56596
This commit is contained in:
@@ -2983,7 +2983,7 @@ def get_work_order_operation_data(work_order, operation, workstation):
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def create_pick_list(source_name, target_doc=None, for_qty=None):
|
||||
def create_pick_list(source_name: str, target_doc: str | dict | None = None, for_qty: float | None = None):
|
||||
for_qty = for_qty or json.loads(target_doc).get("for_qty")
|
||||
max_finished_goods_qty = frappe.db.get_value("Work Order", source_name, "qty")
|
||||
|
||||
@@ -3013,6 +3013,7 @@ def create_pick_list(source_name, target_doc=None, for_qty=None):
|
||||
"Work Order": {"doctype": "Pick List", "validation": {"docstatus": ["=", 1]}},
|
||||
"Work Order Item": {
|
||||
"doctype": "Pick List Item",
|
||||
"field_no_map": ["transferred_qty"],
|
||||
"postprocess": update_item_quantity,
|
||||
"condition": lambda doc: abs(doc.transferred_qty) < abs(doc.required_qty),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user