frappe.ui.form.on(‘Project’, {
refresh: function (frm) {
// Add the “Add New Task” button
frm.add_custom_button(__(‘Add New Task’), function () {
// Create a new Task document with pre-filled values
frappe.new_doc(‘Task’, {
project: frm.doc.name, // Link the Task to the current Project
subject: Task for ${frm.doc.name}
, // Set a default subject for the Task
department: frm.doc.department, // Pre-fill the department from the Project
});
}, __(‘Actions’)); // Group the button under “Actions”
},
});