mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-18 08:58:43 +00:00
fix: job card timer issue (#56405)
(cherry picked from commit 21541e3ad3)
Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com>
This commit is contained in:
@@ -694,10 +694,11 @@ frappe.ui.form.on("Job Card", {
|
|||||||
// ── Wire up button click handlers ─────────────────────────────────
|
// ── Wire up button click handlers ─────────────────────────────────
|
||||||
if (show_start) {
|
if (show_start) {
|
||||||
wrapper.find(".jcd-btn-start").on("click", () => {
|
wrapper.find(".jcd-btn-start").on("click", () => {
|
||||||
const from_time = frappe.datetime.now_datetime();
|
|
||||||
const has_no_employee = !frm.doc.employee || !frm.doc.employee.length;
|
const has_no_employee = !frm.doc.employee || !frm.doc.employee.length;
|
||||||
|
|
||||||
if (has_no_employee) {
|
if (has_no_employee) {
|
||||||
|
// Capture the start time only when the employee dialog is submitted, not on click,
|
||||||
|
// so the time spent selecting the operator is not counted as worked time.
|
||||||
frappe.prompt(
|
frappe.prompt(
|
||||||
{
|
{
|
||||||
fieldtype: "Table MultiSelect",
|
fieldtype: "Table MultiSelect",
|
||||||
@@ -707,11 +708,11 @@ frappe.ui.form.on("Job Card", {
|
|||||||
reqd: 1,
|
reqd: 1,
|
||||||
filters: { status: "Active" },
|
filters: { status: "Active" },
|
||||||
},
|
},
|
||||||
(d) => frm.events.start_timer(frm, from_time, d.employees),
|
(d) => frm.events.start_timer(frm, frappe.datetime.now_datetime(), d.employees),
|
||||||
__("Assign Job to Employee")
|
__("Assign Job to Employee")
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
frm.events.start_timer(frm, from_time, frm.doc.employee);
|
frm.events.start_timer(frm, frappe.datetime.now_datetime(), frm.doc.employee);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user