mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-17 00:18:39 +00:00
fix: require material transfer before job card start and completion
When the work order transfers material against Job Card, the Start Job and Complete Job actions (and the whitelisted start_timer and complete_job_card methods behind them) accepted work before any Material Transfer for Manufacture existed; the transfer gate only fired on job card submission. Run validate_transfer_qty on both actions, and drop the finished_good escape in materials_ready so the dashboard hides the buttons while transfer is pending. Job cards that skip material transfer, corrective job cards, and work orders transferring against Work Order are exempt, as on submit.
This commit is contained in:
@@ -597,8 +597,7 @@ frappe.ui.form.on("Job Card", {
|
||||
const has_remaining_qty = doc.for_quantity + doc.process_loss_qty > doc.total_completed_qty;
|
||||
const pending_transfer =
|
||||
has_items && doc.items.some((row) => flt(row.transferred_qty) < flt(row.required_qty));
|
||||
const materials_ready =
|
||||
doc.skip_material_transfer || !pending_transfer || !doc.finished_good || !has_items;
|
||||
const materials_ready = doc.skip_material_transfer || !pending_transfer;
|
||||
|
||||
let last_row = {};
|
||||
const has_sub_ops_or_pending_qty = doc.sub_operations?.length || doc.pending_qty > 0;
|
||||
|
||||
@@ -1692,6 +1692,7 @@ class JobCard(Document):
|
||||
frappe.has_permission("Job Card", "write", doc=self, throw=True)
|
||||
|
||||
self.validate_docstatus()
|
||||
self.validate_transfer_qty()
|
||||
|
||||
if isinstance(kwargs, dict):
|
||||
kwargs = frappe._dict(kwargs)
|
||||
@@ -1707,6 +1708,7 @@ class JobCard(Document):
|
||||
frappe.has_permission("Job Card", "write", doc=self, throw=True)
|
||||
|
||||
self.validate_docstatus()
|
||||
self.validate_transfer_qty()
|
||||
|
||||
if isinstance(kwargs, dict):
|
||||
kwargs = frappe._dict(kwargs)
|
||||
|
||||
Reference in New Issue
Block a user