fix: exclude current doc when checking for duplicate

This commit is contained in:
Sagar Vora
2025-03-14 23:51:30 +05:30
parent 3be570b44a
commit d8ef5e4d58
2 changed files with 7 additions and 1 deletions

View File

@@ -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):

View File

@@ -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(