Merge pull request #46533 from sagarvora/fix-dupl-se

fix: exclude current doc when checking for duplicate
This commit is contained in:
Sagar Vora
2025-03-15 00:06:33 +05:30
committed by GitHub
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(