fix: recursion issue while submitting work order (backport #40400) (#40401)

* fix: recursion issue while submitting work order (#40400)

(cherry picked from commit 72614bb8ff)

# Conflicts:
#	erpnext/manufacturing/doctype/job_card/job_card.py

* chore: fix conflicts

---------

Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com>
This commit is contained in:
mergify[bot]
2024-03-12 16:53:48 +05:30
committed by GitHub
parent 80df6094e3
commit 06e38749bc

View File

@@ -215,7 +215,7 @@ class JobCard(Document):
if not self.has_overlap(production_capacity, existing_time_logs):
return {}
if self.workstation_type:
if not self.workstation and self.workstation_type:
if workstation := self.get_workstation_based_on_available_slot(existing_time_logs):
self.workstation = workstation
return None
@@ -305,7 +305,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: