Skip to content

Commit

Permalink
fix(ux): Task creation from Timesheet (backport #38207) (#38211)
Browse files Browse the repository at this point in the history
* fix(ux): enable `Quick Entry` for `Task`

(cherry picked from commit 331ad62)

* fix: add route options for new `Task`

(cherry picked from commit 2f3fc12)

---------

Co-authored-by: s-aga-r <[email protected]>
  • Loading branch information
mergify[bot] and s-aga-r authored Nov 20, 2023
1 parent 3f57a7e commit e272041
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
5 changes: 4 additions & 1 deletion erpnext/projects/doctype/task/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
],
"fields": [
{
"allow_in_quick_entry": 1,
"fieldname": "subject",
"fieldtype": "Data",
"in_global_search": 1,
Expand All @@ -66,6 +67,7 @@
"search_index": 1
},
{
"allow_in_quick_entry": 1,
"bold": 1,
"fieldname": "project",
"fieldtype": "Link",
Expand Down Expand Up @@ -396,7 +398,7 @@
"is_tree": 1,
"links": [],
"max_attachments": 5,
"modified": "2023-09-28 13:52:05.861175",
"modified": "2023-11-20 11:42:41.884069",
"modified_by": "Administrator",
"module": "Projects",
"name": "Task",
Expand All @@ -416,6 +418,7 @@
"write": 1
}
],
"quick_entry": 1,
"search_fields": "subject",
"show_name_in_global_search": 1,
"show_preview_popup": 1,
Expand Down
9 changes: 9 additions & 0 deletions erpnext/projects/doctype/timesheet/timesheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ frappe.ui.form.on("Timesheet", {

frm.trigger('setup_filters');
frm.trigger('set_dynamic_field_label');
frm.trigger('set_route_options_for_new_task');
},

customer: function(frm) {
Expand Down Expand Up @@ -172,6 +173,14 @@ frappe.ui.form.on("Timesheet", {
frm.refresh_fields();
},

set_route_options_for_new_task: (frm) => {
let task_field = frm.get_docfield('time_logs', 'task');

if (task_field) {
task_field.get_route_options_for_new_doc = (row) => ({'project': row.doc.project});
}
},

make_invoice: function(frm) {
let fields = [{
"fieldtype": "Link",
Expand Down

0 comments on commit e272041

Please sign in to comment.