diff --git a/erpnext/stock/doctype/pick_list/pick_list.py b/erpnext/stock/doctype/pick_list/pick_list.py index 21b9cc10543..efe6da8e157 100644 --- a/erpnext/stock/doctype/pick_list/pick_list.py +++ b/erpnext/stock/doctype/pick_list/pick_list.py @@ -16,6 +16,15 @@ from erpnext.selling.doctype.sales_order.sales_order import make_delivery_note a # TODO: Prioritize SO or WO group warehouse class PickList(Document): + def before_submit(self): + for item in self.locations: + if not frappe.get_cached_value('Item', item.item_code, 'has_serial_no'): + continue + if len(item.serial_no.split('\n')) == item.picked_qty: + continue + frappe.throw(_('For item {0} at row {1}, count of serial numbers does not match with the picked quantity') + .format(frappe.bold(item.item_code), frappe.bold(item.idx))) + def set_item_locations(self): items = self.aggregate_item_qty() self.item_location_map = frappe._dict()