diff --git a/selling/page/sales_browser/sales_browser.js b/selling/page/sales_browser/sales_browser.js index ed13f9df31..8506bc6c20 100644 --- a/selling/page/sales_browser/sales_browser.js +++ b/selling/page/sales_browser/sales_browser.js @@ -122,16 +122,24 @@ erpnext.SalesChart = Class.extend({ }, new_node: function() { var me = this; - + + var fields = [ + {fieldtype:'Data', fieldname: 'name_field', + label:'New ' + me.ctype + ' Name', reqd:true}, + {fieldtype:'Select', fieldname:'is_group', label:'Group Node', options:'No\nYes', + description: "Further nodes can be only created under 'Group' type nodes"}, + {fieldtype:'Button', fieldname:'create_new', label:'Create New' } + ] + + if(me.ctype == "Sales Person") { + fields.splice(-1, 0, {fieldtype:'Link', fieldname:'employee', label:'Employee', + options:'Employee', description: "Please enter Employee Id of this sales parson"}); + } + // the dialog var d = new wn.ui.Dialog({ title:'New ' + me.ctype, - fields: [ - {fieldtype:'Data', fieldname: 'name_field', label:'New ' + me.ctype + ' Name', reqd:true}, - {fieldtype:'Select', fieldname:'is_group', label:'Group Node', - options:'No\nYes', description: "Further nodes can be only created under 'Group' type nodes"}, - {fieldtype:'Button', fieldname:'create_new', label:'Create New' } - ] + fields: fields }) d.set_value("is_group", "No"); diff --git a/selling/page/sales_browser/sales_browser.py b/selling/page/sales_browser/sales_browser.py index b12c0f4d75..6693fe53b6 100644 --- a/selling/page/sales_browser/sales_browser.py +++ b/selling/page/sales_browser/sales_browser.py @@ -30,4 +30,7 @@ def add_node(): parent_field: webnotes.form_dict['parent'], "is_group": webnotes.form_dict['is_group'] }] + if ctype == "Sales Person": + doclist[0]["employee"] = webnotes.form_dict.get('employee') + webnotes.bean(doclist).save() \ No newline at end of file