read only fields project and hours
This commit is contained in:
parent
6a1bf70627
commit
eeaba29e5b
@ -69,13 +69,19 @@ frappe.ui.form.on("Timesheet", {
|
|||||||
{"fieldtype": "Select", "label": __("Activity"),
|
{"fieldtype": "Select", "label": __("Activity"),
|
||||||
"fieldname": "activity",
|
"fieldname": "activity",
|
||||||
"options": frm.doc.time_logs.map(d => d.activity_type),
|
"options": frm.doc.time_logs.map(d => d.activity_type),
|
||||||
"reqd": 1 },
|
"reqd": 1,
|
||||||
{"fieldtype": "Select", "label": __("Project"),
|
onchange: () => {
|
||||||
"fieldname": "project",
|
const activity = dialog.get_value("activity")
|
||||||
"options": frm.doc.time_logs.map(d => d.project)},
|
const hours = frm.doc.time_logs.filter(d => d.activity_type == activity).map(d => d.hours);
|
||||||
{"fieldtype": "Select", "label": __("Hours"),
|
const project = frm.doc.time_logs.filter(d => d.activity_type == activity).map(d => d.project)
|
||||||
"fieldname": "hours",
|
|
||||||
"options": frm.doc.time_logs.map(d => d.hours)}
|
dialog.set_value("hours", hours)
|
||||||
|
dialog.set_value("project", project)
|
||||||
|
}},
|
||||||
|
{"fieldtype": "Read Only", "label": __("Project"),
|
||||||
|
"fieldname": "project"},
|
||||||
|
{"fieldtype": "Read Only", "label": __("Hours"),
|
||||||
|
"fieldname": "hours"}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
dialog.wrapper.append(frappe.render_template("timesheet"));
|
dialog.wrapper.append(frappe.render_template("timesheet"));
|
||||||
@ -96,6 +102,7 @@ frappe.ui.form.on("Timesheet", {
|
|||||||
frappe.msgprint(__("Please select Activity"));
|
frappe.msgprint(__("Please select Activity"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clicked) {
|
if (clicked) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user