Merge branch 'master' of github.com:webnotes/erpnext

This commit is contained in:
Anand Doshi
2013-07-23 11:02:22 +05:30
4 changed files with 21 additions and 11 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()