fix: auto-fulfill picking list when not in scan mode

This commit is contained in:
Ankush Menat 2022-03-28 18:52:46 +05:30 committed by Devin Slauenwhite
parent 7ae89dedd5
commit d48ab81622
2 changed files with 18 additions and 3 deletions

View File

@ -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",

View File

@ -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