Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(job card): only hold during draft state #31243

Merged
merged 1 commit into from
Jun 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion erpnext/manufacturing/doctype/job_card/job_card.py
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ def set_transferred_qty(self, update_status=False):
self.set_status(update_status)

def set_status(self, update_status=False):
if self.status == "On Hold":
if self.status == "On Hold" and self.docstatus == 0:
return

self.status = {0: "Open", 1: "Submitted", 2: "Cancelled"}[self.docstatus or 0]
Expand Down
1 change: 1 addition & 0 deletions erpnext/patches.txt
Original file line number Diff line number Diff line change
Expand Up @@ -373,3 +373,4 @@ erpnext.patches.v13_0.create_accounting_dimensions_in_orders
erpnext.patches.v13_0.set_per_billed_in_return_delivery_note
execute:frappe.delete_doc("DocType", "Naming Series")
erpnext.patches.v13_0.set_payroll_entry_status
erpnext.patches.v13_0.job_card_status_on_hold
19 changes: 19 additions & 0 deletions erpnext/patches/v13_0/job_card_status_on_hold.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import frappe


def execute():
job_cards = frappe.get_all(
"Job Card",
{"status": "On Hold", "docstatus": ("!=", 0)},
pluck="name",
)

for idx, job_card in enumerate(job_cards):
try:
doc = frappe.get_doc("Job Card", job_card)
doc.set_status()
doc.db_set("status", doc.status, update_modified=False)
if idx % 100 == 0:
frappe.db.commit()
except Exception:
continue