mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-13 14:41:53 +00:00
fix: require material transfer before job card time logs
v15 adaptation of the develop fix: the timer flow here runs through add_time_log via make_time_log, so gate that instead of the start_timer/complete_job_card methods that only exist on develop, and hide Start Job while transfer is pending. Corrective job cards and job cards without items (transfer against Work Order) stay exempt, matching validate_transfer_qty on submit.
This commit is contained in:
@@ -296,7 +296,16 @@ frappe.ui.form.on("Job Card", {
|
|||||||
prepare_timer_buttons: function (frm) {
|
prepare_timer_buttons: function (frm) {
|
||||||
frm.trigger("make_dashboard");
|
frm.trigger("make_dashboard");
|
||||||
|
|
||||||
|
const transfer_pending =
|
||||||
|
!frm.doc.is_corrective_job_card &&
|
||||||
|
(frm.doc.items || []).length &&
|
||||||
|
flt(frm.doc.transferred_qty) < flt(frm.doc.for_quantity);
|
||||||
|
|
||||||
if (!frm.doc.started_time && !frm.doc.current_time) {
|
if (!frm.doc.started_time && !frm.doc.current_time) {
|
||||||
|
if (transfer_pending) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
frm.add_custom_button(__("Start Job"), () => {
|
frm.add_custom_button(__("Start Job"), () => {
|
||||||
if ((frm.doc.employee && !frm.doc.employee.length) || !frm.doc.employee) {
|
if ((frm.doc.employee && !frm.doc.employee.length) || !frm.doc.employee) {
|
||||||
frappe.prompt(
|
frappe.prompt(
|
||||||
|
|||||||
@@ -513,6 +513,8 @@ class JobCard(Document):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def add_time_log(self, args):
|
def add_time_log(self, args):
|
||||||
|
self.validate_transfer_qty()
|
||||||
|
|
||||||
last_row = []
|
last_row = []
|
||||||
employees = args.employees
|
employees = args.employees
|
||||||
if isinstance(employees, str):
|
if isinstance(employees, str):
|
||||||
|
|||||||
Reference in New Issue
Block a user