fix: exclude current doc when checking for duplicate

(cherry picked from commit d8ef5e4d58)
This commit is contained in:
Sagar Vora
2025-03-14 23:51:30 +05:30
committed by Mergify
parent 1a9873bc55
commit b638aed758
2 changed files with 7 additions and 1 deletions

View File

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

View File

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