fix: incorrect production item and bom no in job card

This commit is contained in:
Mihir Kandoi
2025-03-17 16:06:54 +05:30
parent 61e126901e
commit d071a6c900
4 changed files with 12 additions and 8 deletions

View File

@@ -86,7 +86,6 @@
"search_index": 1 "search_index": 1
}, },
{ {
"fetch_from": "work_order.bom_no",
"fieldname": "bom_no", "fieldname": "bom_no",
"fieldtype": "Link", "fieldtype": "Link",
"label": "BOM No", "label": "BOM No",
@@ -281,7 +280,7 @@
"fieldtype": "Column Break" "fieldtype": "Column Break"
}, },
{ {
"fetch_from": "work_order.production_item", "fetch_from": "bom_no.item",
"fieldname": "production_item", "fieldname": "production_item",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Production Item", "label": "Production Item",
@@ -511,7 +510,7 @@
], ],
"is_submittable": 1, "is_submittable": 1,
"links": [], "links": [],
"modified": "2023-06-28 19:23:14.345214", "modified": "2025-03-17 15:55:11.143456",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Manufacturing", "module": "Manufacturing",
"name": "Job Card", "name": "Job Card",

View File

@@ -64,9 +64,7 @@ class JobCard(Document):
from erpnext.manufacturing.doctype.job_card_scheduled_time.job_card_scheduled_time import ( from erpnext.manufacturing.doctype.job_card_scheduled_time.job_card_scheduled_time import (
JobCardScheduledTime, JobCardScheduledTime,
) )
from erpnext.manufacturing.doctype.job_card_scrap_item.job_card_scrap_item import ( from erpnext.manufacturing.doctype.job_card_scrap_item.job_card_scrap_item import JobCardScrapItem
JobCardScrapItem,
)
from erpnext.manufacturing.doctype.job_card_time_log.job_card_time_log import JobCardTimeLog from erpnext.manufacturing.doctype.job_card_time_log.job_card_time_log import JobCardTimeLog
actual_end_date: DF.Datetime | None actual_end_date: DF.Datetime | None
@@ -91,7 +89,7 @@ class JobCard(Document):
naming_series: DF.Literal["PO-JOB.#####"] naming_series: DF.Literal["PO-JOB.#####"]
operation: DF.Link operation: DF.Link
operation_id: DF.Data | None operation_id: DF.Data | None
operation_row_number: DF.Literal operation_row_number: DF.Literal[None]
posting_date: DF.Date | None posting_date: DF.Date | None
process_loss_qty: DF.Float process_loss_qty: DF.Float
production_item: DF.Link | None production_item: DF.Link | None

View File

@@ -301,6 +301,12 @@ frappe.ui.form.on("Work Order", {
label: __("Sequence Id"), label: __("Sequence Id"),
read_only: 1, read_only: 1,
}, },
{
fieldtype: "Link",
fieldname: "bom",
label: __("BOM"),
read_only: 1,
},
], ],
data: operations_data, data: operations_data,
in_place_edit: true, in_place_edit: true,
@@ -341,6 +347,7 @@ frappe.ui.form.on("Work Order", {
qty: pending_qty, qty: pending_qty,
pending_qty: pending_qty, pending_qty: pending_qty,
sequence_id: data.sequence_id, sequence_id: data.sequence_id,
bom: data.bom,
}); });
} }
} }

View File

@@ -1616,7 +1616,7 @@ def create_job_card(work_order, row, enable_capacity_planning=False, auto_create
"posting_date": nowdate(), "posting_date": nowdate(),
"for_quantity": row.job_card_qty or work_order.get("qty", 0), "for_quantity": row.job_card_qty or work_order.get("qty", 0),
"operation_id": row.get("name"), "operation_id": row.get("name"),
"bom_no": work_order.bom_no, "bom_no": row.get("bom"),
"project": work_order.project, "project": work_order.project,
"company": work_order.company, "company": work_order.company,
"sequence_id": row.get("sequence_id"), "sequence_id": row.get("sequence_id"),