From d48ab81622de00c1f088caa435468476cfd9c727 Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Mon, 28 Mar 2022 18:52:46 +0530 Subject: [PATCH] fix: auto-fulfill picking list when not in scan mode --- erpnext/stock/doctype/pick_list/pick_list.json | 15 ++++++++++++++- erpnext/stock/doctype/pick_list/pick_list.py | 6 ++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/erpnext/stock/doctype/pick_list/pick_list.json b/erpnext/stock/doctype/pick_list/pick_list.json index f32a05a266f..f2d7543cae9 100644 --- a/erpnext/stock/doctype/pick_list/pick_list.json +++ b/erpnext/stock/doctype/pick_list/pick_list.json @@ -18,6 +18,8 @@ "get_item_locations", "section_break_6", "scan_barcode", + "column_break_13", + "scan_mode", "section_break_15", "locations", "amended_from", @@ -138,11 +140,22 @@ "fieldtype": "Data", "label": "Scan Barcode", "options": "Barcode" + }, + { + "fieldname": "column_break_13", + "fieldtype": "Column Break" + }, + { + "default": "0", + "description": "If checked, picked qty won't automatically be fulfilled on submit of pick list.", + "fieldname": "scan_mode", + "fieldtype": "Check", + "label": "Scan Mode" } ], "is_submittable": 1, "links": [], - "modified": "2022-04-29 13:45:24.401314", + "modified": "2022-05-04 11:12:48.044239", "modified_by": "Administrator", "module": "Stock", "name": "Pick List", diff --git a/erpnext/stock/doctype/pick_list/pick_list.py b/erpnext/stock/doctype/pick_list/pick_list.py index ce3ec60d7ac..d2e266f9654 100644 --- a/erpnext/stock/doctype/pick_list/pick_list.py +++ b/erpnext/stock/doctype/pick_list/pick_list.py @@ -41,14 +41,16 @@ class PickList(Document): def before_submit(self): update_sales_orders = set() for item in self.locations: - # if the user has not entered any picked qty, set it to stock_qty, before submit - if item.picked_qty < item.stock_qty: + if self.scan_mode and item.picked_qty < item.stock_qty: frappe.throw( _("Row {0} is short by {1} {2}").format( item.idx, item.stock_qty - item.picked_qty, item.stock_uom ), title=_("Pick List Incomplete"), ) + elif not self.scan_mode and item.picked_qty == 0: + # if the user has not entered any picked qty, set it to stock_qty, before submit + item.picked_qty = item.stock_qty if item.sales_order_item: # update the picked_qty in SO Item