diff --git a/erpnext/manufacturing/doctype/work_order/test_work_order.py b/erpnext/manufacturing/doctype/work_order/test_work_order.py index be156d83303..e66a9ebfaac 100644 --- a/erpnext/manufacturing/doctype/work_order/test_work_order.py +++ b/erpnext/manufacturing/doctype/work_order/test_work_order.py @@ -51,6 +51,7 @@ class TestWorkOrder(IntegrationTestCase): 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 a4368f61f10..7c069862520 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -934,7 +934,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(