fix(job card): only hold during draft state (#31243)
This commit is contained in:
parent
c66c1e2215
commit
ee5bc58e9b
@ -621,7 +621,7 @@ class JobCard(Document):
|
||||
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]
|
||||
|
@ -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
erpnext/patches/v13_0/job_card_status_on_hold.py
Normal file
19
erpnext/patches/v13_0/job_card_status_on_hold.py
Normal file
@ -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
|
Loading…
x
Reference in New Issue
Block a user