From 7282c8e65b74d327e62ebbfed856781857337cc2 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Tue, 5 Jul 2022 12:36:22 +0530 Subject: [PATCH] fix: test case --- erpnext/manufacturing/doctype/work_order/test_work_order.py | 2 +- erpnext/stock/doctype/stock_entry/stock_entry.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/manufacturing/doctype/work_order/test_work_order.py b/erpnext/manufacturing/doctype/work_order/test_work_order.py index 6bb4cfcead..b556d9974a 100644 --- a/erpnext/manufacturing/doctype/work_order/test_work_order.py +++ b/erpnext/manufacturing/doctype/work_order/test_work_order.py @@ -1243,7 +1243,7 @@ class TestWorkOrder(FrappeTestCase): ste_doc.insert() ste_doc.submit() - batch_list = [row.batch_no for row in ste_doc.items] + batch_list = sorted([row.batch_no for row in ste_doc.items]) wo_doc = make_wo_order_test_record(production_item=fg_item, qty=4) transferred_ste_doc = frappe.get_doc( diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index 4b2850e279..46a1e70b05 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -1661,7 +1661,8 @@ class StockEntry(StockController): qty = frappe.utils.ceil(qty) if row.batch_details: - for batch_no, batch_qty in row.batch_details.items(): + batches = sorted(row.batch_details.items(), key=lambda x: x[0]) + for batch_no, batch_qty in batches: if qty <= 0 or batch_qty <= 0: continue