Merge pull request #52887 from frappe/mergify/bp/version-16-hotfix/pr-52840

fix(manufacturing): remove delete query of job card & batch and serial no  (backport #52840)
This commit is contained in:
ruthra kumar
2026-02-23 17:39:28 +05:30
committed by GitHub
2 changed files with 0 additions and 14 deletions

View File

@@ -56,7 +56,6 @@ class TestRouting(IntegrationTestCase):
self.assertEqual(job_card_doc.total_completed_qty, 10)
wo_doc.cancel()
wo_doc.delete()
def test_update_bom_operation_time(self):
"""Update cost shouldn't update routing times."""

View File

@@ -780,7 +780,6 @@ class WorkOrder(Document):
self.db_set("status", "Cancelled")
self.on_close_or_cancel()
self.delete_job_card()
def on_close_or_cancel(self):
if self.production_plan and frappe.db.exists(
@@ -794,7 +793,6 @@ class WorkOrder(Document):
self.update_planned_qty()
self.update_ordered_qty()
self.update_reserved_qty_for_production()
self.delete_auto_created_batch_and_serial_no()
if self.reserve_stock:
self.update_stock_reservation()
@@ -926,13 +924,6 @@ class WorkOrder(Document):
)
)
def delete_auto_created_batch_and_serial_no(self):
for row in frappe.get_all("Serial No", filters={"work_order": self.name}):
frappe.delete_doc("Serial No", row.name)
for row in frappe.get_all("Batch", filters={"reference_name": self.name}):
frappe.delete_doc("Batch", row.name)
def make_serial_nos(self, args):
item_details = frappe.get_cached_value(
"Item", self.production_item, ["serial_no_series", "item_name", "description"], as_dict=1
@@ -1384,10 +1375,6 @@ class WorkOrder(Document):
if self.actual_start_date and self.actual_end_date:
self.lead_time = flt(time_diff_in_hours(self.actual_end_date, self.actual_start_date) * 60)
def delete_job_card(self):
for d in frappe.get_all("Job Card", ["name"], {"work_order": self.name}):
frappe.delete_doc("Job Card", d.name)
def validate_production_item(self):
if frappe.get_cached_value("Item", self.production_item, "has_variants"):
frappe.throw(_("Work Order cannot be raised against a Item Template"), ItemHasVariantError)