button triggers not working in tasks table (#13973)

This commit is contained in:
Zarrar 2018-05-14 14:29:01 +05:30 committed by Rushabh Mehta
parent f93cc57e8a
commit 8646ed45bc

View File

@ -87,25 +87,27 @@ frappe.ui.form.on("Project", {
} }
}); });
}, },
edit_task: function (frm, doctype, name) { });
frappe.ui.form.on("Project Task", {
edit_task: function(frm, doctype, name) {
var doc = frappe.get_doc(doctype, name); var doc = frappe.get_doc(doctype, name);
if (doc.task_id) { if(doc.task_id) {
frappe.set_route("Form", "Task", doc.task_id); frappe.set_route("Form", "Task", doc.task_id);
} else { } else {
frappe.msgprint(__("Save the document first.")); frappe.msgprint(__("Save the document first."));
} }
}, },
edit_timesheet: function (frm, cdt, cdn) {
edit_timesheet: function(frm, cdt, cdn) {
var child = locals[cdt][cdn]; var child = locals[cdt][cdn];
frappe.route_options = { frappe.route_options = {"project": frm.doc.project_name, "task": child.task_id};
"project": frm.doc.project_name,
"task": child.task_id
};
frappe.set_route("List", "Timesheet"); frappe.set_route("List", "Timesheet");
}, },
make_timesheet: function (frm, cdt, cdn) {
make_timesheet: function(frm, cdt, cdn) {
var child = locals[cdt][cdn]; var child = locals[cdt][cdn];
frappe.model.with_doctype('Timesheet', function () { frappe.model.with_doctype('Timesheet', function() {
var doc = frappe.model.get_new_doc('Timesheet'); var doc = frappe.model.get_new_doc('Timesheet');
var row = frappe.model.add_child(doc, 'time_logs'); var row = frappe.model.add_child(doc, 'time_logs');
row.project = frm.doc.project_name; row.project = frm.doc.project_name;
@ -114,13 +116,11 @@ frappe.ui.form.on("Project", {
}) })
}, },
status: function (frm, doctype, name) { status: function(frm, doctype, name) {
frm.trigger('tasks_refresh'); frm.trigger('tasks_refresh');
}, },
}); });
frappe.ui.form.on("Project", "validate", function (frm) { frappe.ui.form.on("Project", "validate", function (frm) {
frappe.call({ frappe.call({
method: "erpnext.projects.doctype.project.project.times_check", method: "erpnext.projects.doctype.project.project.times_check",