From daaae6786ae51ec97338c92faf2441acf5ea0203 Mon Sep 17 00:00:00 2001 From: Rohan Bansal Date: Mon, 1 Apr 2019 17:25:07 +0530 Subject: [PATCH] fix(todo): Use priority in source document, if available, for ToDo --- .../public/js/frappe/form/footer/assign_to.js | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/frappe/public/js/frappe/form/footer/assign_to.js b/frappe/public/js/frappe/form/footer/assign_to.js index 95ddebcc99..15255b20de 100644 --- a/frappe/public/js/frappe/form/footer/assign_to.js +++ b/frappe/public/js/frappe/form/footer/assign_to.js @@ -134,22 +134,23 @@ frappe.ui.form.AssignToDialog = Class.extend({ var dialog = new frappe.ui.Dialog({ title: __('Add to To Do'), fields: [ - {fieldtype: 'Link', fieldname:'assign_to', options:'User', - label:__("Assign To"), reqd:true, filters: {'user_type': 'System User'}}, - {fieldtype:'Check', fieldname:'myself', label:__("Assign to me"), "default":0}, - {fieldtype:'Small Text', fieldname:'description', label:__("Comment")}, - {fieldtype: 'Section Break'}, - {fieldtype: 'Column Break'}, - {fieldtype:'Date', fieldname:'date', label: __("Complete By")}, - {fieldtype:'Check', fieldname:'notify', - label:__("Notify by Email")}, - {fieldtype: 'Column Break'}, - {fieldtype:'Select', fieldname:'priority', label: __("Priority"), - options:[ - {value:'Low', label:__('Low')}, - {value:'Medium', label:__('Medium')}, - {value:'High', label:__('High')}], - 'default':'Medium'}, + { fieldtype: 'Link', fieldname: 'assign_to', options: 'User', label: __("Assign To"), reqd: true, filters: { 'user_type': 'System User' }}, + { fieldtype: 'Check', fieldname: 'myself', label: __("Assign to me"), "default": 0 }, + { fieldtype: 'Small Text', fieldname: 'description', label: __("Comment") }, + { fieldtype: 'Section Break' }, + { fieldtype: 'Column Break' }, + { fieldtype: 'Date', fieldname: 'date', label: __("Complete By") }, + { fieldtype: 'Check', fieldname: 'notify', label: __("Notify by Email") }, + { fieldtype: 'Column Break' }, + { fieldtype: 'Select', fieldname: 'priority', label: __("Priority"), + options: [ + { value: 'Low', label: __('Low') }, + { value: 'Medium', label: __('Medium') }, + { value: 'High', label: __('High') } + ], + // Pick up priority from the source document, if it exists and is available in ToDo + 'default': ["Low", "Medium", "High"].includes(opts.obj.frm.doc.priority) ? opts.obj.frm.doc.priority : 'Medium' + }, ], primary_action: function() { frappe.ui.add_assignment(opts, this) }, primary_action_label: __("Add")