From 03d774273760dbd643e2135427d0bb5de99232b7 Mon Sep 17 00:00:00 2001 From: s-aga-r Date: Thu, 1 Jun 2023 13:29:17 +0530 Subject: [PATCH 1/2] fix: ignore `Non-Stock Item` mapping in Pick List --- erpnext/stock/doctype/pick_list/pick_list.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/erpnext/stock/doctype/pick_list/pick_list.py b/erpnext/stock/doctype/pick_list/pick_list.py index a9a9a1d664..d3af620508 100644 --- a/erpnext/stock/doctype/pick_list/pick_list.py +++ b/erpnext/stock/doctype/pick_list/pick_list.py @@ -265,6 +265,10 @@ class PickList(Document): for item in locations: if not item.item_code: frappe.throw("Row #{0}: Item Code is Mandatory".format(item.idx)) + if not cint( + frappe.get_cached_value("Item", item.item_code, "is_stock_item") + ) and not frappe.db.exists("Product Bundle", {"new_item_code": item.item_code}): + continue item_code = item.item_code reference = item.sales_order_item or item.material_request_item key = (item_code, item.uom, item.warehouse, item.batch_no, reference) From 0305a925fe8425d8488278258243ca056ddccc61 Mon Sep 17 00:00:00 2001 From: s-aga-r Date: Thu, 1 Jun 2023 13:30:01 +0530 Subject: [PATCH 2/2] fix: ignore `Non-Stock Item` while calculating `% Picked` in Sales Order --- erpnext/selling/doctype/sales_order/sales_order.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py index 353fa9bb29..d3c2347216 100755 --- a/erpnext/selling/doctype/sales_order/sales_order.py +++ b/erpnext/selling/doctype/sales_order/sales_order.py @@ -415,10 +415,17 @@ class SalesOrder(SellingController): def update_picking_status(self): total_picked_qty = 0.0 total_qty = 0.0 + per_picked = 0.0 + for so_item in self.items: - total_picked_qty += flt(so_item.picked_qty) - total_qty += flt(so_item.stock_qty) - per_picked = total_picked_qty / total_qty * 100 + if cint( + frappe.get_cached_value("Item", so_item.item_code, "is_stock_item") + ) or self.has_product_bundle(so_item.item_code): + total_picked_qty += flt(so_item.picked_qty) + total_qty += flt(so_item.stock_qty) + + if total_picked_qty and total_qty: + per_picked = total_picked_qty / total_qty * 100 self.db_set("per_picked", flt(per_picked), update_modified=False)