[minor] [fix] employee field while new sales person created from tree

This commit is contained in:
Nabin Hait 2013-07-22 17:15:01 +05:30
parent 50f5fd13c7
commit d351318014
2 changed files with 18 additions and 7 deletions

View File

@ -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");

View File

@ -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()