From d6e87f3f1748e702bf6c7f4600776705dc4a7117 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Tue, 12 Mar 2024 16:50:00 +0530 Subject: [PATCH] fix: recursion issue while submitting work order (backport #40400) (#40402) * fix: recursion issue while submitting work order (#40400) (cherry picked from commit 72614bb8ffb9ff83d40f1caa301464dad633aeda) * chore: fix linter issue --------- Co-authored-by: rohitwaghchaure --- erpnext/manufacturing/doctype/job_card/job_card.py | 4 ++-- erpnext/public/js/utils/serial_no_batch_selector.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/manufacturing/doctype/job_card/job_card.py b/erpnext/manufacturing/doctype/job_card/job_card.py index 7d3d52f8c15..6144aad7bdd 100644 --- a/erpnext/manufacturing/doctype/job_card/job_card.py +++ b/erpnext/manufacturing/doctype/job_card/job_card.py @@ -264,7 +264,7 @@ class JobCard(Document): if not self.has_overlap(production_capacity, time_logs): return {} - if self.workstation_type and time_logs: + if not self.workstation and self.workstation_type and time_logs: if workstation_time := self.get_workstation_based_on_available_slot(time_logs): self.workstation = workstation_time.get("workstation") return workstation_time @@ -420,7 +420,7 @@ class JobCard(Document): if not workstation_doc.working_hours or cint( frappe.db.get_single_value("Manufacturing Settings", "allow_overtime") ): - if get_datetime(row.planned_end_time) < get_datetime(row.planned_start_time): + if get_datetime(row.planned_end_time) <= get_datetime(row.planned_start_time): row.planned_end_time = add_to_date(row.planned_start_time, minutes=row.time_in_mins) row.remaining_time_in_mins = 0.0 else: diff --git a/erpnext/public/js/utils/serial_no_batch_selector.js b/erpnext/public/js/utils/serial_no_batch_selector.js index 8f7160d66f9..24133b8cdc3 100644 --- a/erpnext/public/js/utils/serial_no_batch_selector.js +++ b/erpnext/public/js/utils/serial_no_batch_selector.js @@ -611,4 +611,4 @@ erpnext.SerialBatchPackageSelector = class SerialNoBatchBundleUpdate { this.dialog.fields_dict.entries.grid.refresh(); } -}; \ No newline at end of file +};