mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-16 07:58:38 +00:00
Merge pull request #57934 from frappe/mergify/bp/version-16-hotfix/pr-57688
refactor(job_card): make the completion dialog say what it asks for (backport #57688)
This commit is contained in:
@@ -244,10 +244,11 @@ frappe.ui.form.on("Job Card", {
|
||||
const fields = [
|
||||
{
|
||||
fieldtype: "Float",
|
||||
label: __("Qty to Manufacture"),
|
||||
label: __("Qty to Manufacture in this Cycle"),
|
||||
fieldname: "for_quantity",
|
||||
reqd: 1,
|
||||
default: pending_qty,
|
||||
description: __("Completed, Pending and Process Loss quantities must add up to this."),
|
||||
change() {
|
||||
const dialog = frm.job_completion_dialog;
|
||||
dialog.set_value("completed_qty", dialog.get_value("for_quantity"));
|
||||
@@ -287,6 +288,7 @@ frappe.ui.form.on("Job Card", {
|
||||
label: __("Pending Quantity"),
|
||||
fieldname: "pending_qty",
|
||||
default: 0.0,
|
||||
description: __("Qty left for a later cycle or for another job card."),
|
||||
change() {
|
||||
const dialog = frm.job_completion_dialog;
|
||||
const process_loss_qty =
|
||||
@@ -313,6 +315,7 @@ frappe.ui.form.on("Job Card", {
|
||||
fieldtype: "Float",
|
||||
label: __("Process Loss Quantity"),
|
||||
fieldname: "process_loss_qty",
|
||||
description: __("Qty scrapped in this cycle, nobody will produce it."),
|
||||
onchange() {
|
||||
const dialog = frm.job_completion_dialog;
|
||||
const remaining =
|
||||
@@ -394,9 +397,8 @@ frappe.ui.form.on("Job Card", {
|
||||
},
|
||||
});
|
||||
},
|
||||
__("Enter Value"),
|
||||
__("Update"),
|
||||
__("Set Finished Good Quantity")
|
||||
__("Complete Job"),
|
||||
__("Update")
|
||||
);
|
||||
},
|
||||
|
||||
@@ -422,46 +424,6 @@ frappe.ui.form.on("Job Card", {
|
||||
});
|
||||
},
|
||||
|
||||
make_finished_good(frm) {
|
||||
const fields = [
|
||||
{
|
||||
fieldtype: "Float",
|
||||
label: __("Completed Quantity"),
|
||||
fieldname: "qty",
|
||||
reqd: 1,
|
||||
default: frm.doc.for_quantity - frm.doc.manufactured_qty,
|
||||
},
|
||||
{
|
||||
fieldtype: "Datetime",
|
||||
label: __("End Time"),
|
||||
fieldname: "end_time",
|
||||
default: frappe.datetime.now_datetime(),
|
||||
},
|
||||
];
|
||||
|
||||
frappe.prompt(
|
||||
fields,
|
||||
(data) => {
|
||||
if (data.qty <= 0) {
|
||||
frappe.throw(__("Quantity should be greater than 0"));
|
||||
}
|
||||
|
||||
frm.call({
|
||||
method: "make_finished_good",
|
||||
doc: frm.doc,
|
||||
args: { qty: data.qty, end_time: data.end_time },
|
||||
callback(r) {
|
||||
const doc = frappe.model.sync(r.message);
|
||||
frappe.set_route("Form", doc[0].doctype, doc[0].name);
|
||||
},
|
||||
});
|
||||
},
|
||||
__("Enter Value"),
|
||||
__("Update"),
|
||||
__("Set Finished Good Quantity")
|
||||
);
|
||||
},
|
||||
|
||||
setup_quality_inspection(frm) {
|
||||
const quality_inspection_field = frm.get_docfield("quality_inspection");
|
||||
quality_inspection_field.get_route_options_for_new_doc = function (frm) {
|
||||
|
||||
Reference in New Issue
Block a user