diff --git a/erpnext/stock/deprecated_serial_batch.py b/erpnext/stock/deprecated_serial_batch.py index 5ab862b51b3..f946f459c07 100644 --- a/erpnext/stock/deprecated_serial_batch.py +++ b/erpnext/stock/deprecated_serial_batch.py @@ -332,6 +332,8 @@ class DeprecatedBatchNoValuation: if self.sle.voucher_detail_no: query = query.where(sabb.voucher_detail_no != self.sle.voucher_detail_no) + query = query.where(sabb.voucher_type != "Pick List") + data = query.run(as_dict=True) if not data: return {} diff --git a/erpnext/stock/doctype/bin/bin.py b/erpnext/stock/doctype/bin/bin.py index db5d1e58a84..d3de1897633 100644 --- a/erpnext/stock/doctype/bin/bin.py +++ b/erpnext/stock/doctype/bin/bin.py @@ -247,7 +247,7 @@ def update_qty(bin_name, args): & (sle.warehouse == args.get("warehouse")) & (sle.is_cancelled == 0) ) - .orderby(CombineDatetime(sle.posting_date, sle.posting_time), order=Order.desc) + .orderby(sle.posting_datetime, order=Order.desc) .orderby(sle.creation, order=Order.desc) .limit(1) .run()