[minor] [fix] employee field while new sales person created from tree
diff --git a/selling/page/sales_browser/sales_browser.js b/selling/page/sales_browser/sales_browser.js
index ed13f9d..8506bc6 100644
--- a/selling/page/sales_browser/sales_browser.js
+++ b/selling/page/sales_browser/sales_browser.js
@@ -122,16 +122,24 @@
},
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 b12c0f4..6693fe5 100644
--- a/selling/page/sales_browser/sales_browser.py
+++ b/selling/page/sales_browser/sales_browser.py
@@ -30,4 +30,7 @@
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