diff --git a/erpnext/manufacturing/doctype/work_order/test_work_order.py b/erpnext/manufacturing/doctype/work_order/test_work_order.py index 205ca1dbdb4..84f2b75432c 100644 --- a/erpnext/manufacturing/doctype/work_order/test_work_order.py +++ b/erpnext/manufacturing/doctype/work_order/test_work_order.py @@ -42,6 +42,7 @@ class TestWorkOrder(FrappeTestCase): prepare_data_for_backflush_based_on_materials_transferred() def tearDown(self): + frappe.local.future_sle = {} frappe.db.rollback() def check_planned_qty(self): diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index 9b5f9dc9810..3f548a1324d 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -913,7 +913,12 @@ class StockEntry(StockController): if frappe.db.exists( "Stock Entry", - {"docstatus": 1, "work_order": self.work_order, "purpose": "Manufacture"}, + { + "docstatus": 1, + "work_order": self.work_order, + "purpose": "Manufacture", + "name": ("!=", self.name), + }, ): frappe.throw( _("Only one {0} entry can be created against the Work Order {1}").format(