From d351318014c4d95d946e7a34b838308ea3b366e8 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 22 Jul 2013 17:15:01 +0530 Subject: [PATCH 1/2] [minor] [fix] employee field while new sales person created from tree --- selling/page/sales_browser/sales_browser.js | 22 ++++++++++++++------- selling/page/sales_browser/sales_browser.py | 3 +++ 2 files changed, 18 insertions(+), 7 deletions(-) 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 From 9481e037d22c576c70270671c320d9dcfec47374 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 22 Jul 2013 17:28:11 +0530 Subject: [PATCH 2/2] [minor] [fix] pull uom conversion factor in purchase cycle --- buying/utils.py | 2 +- .../doctype/uom_conversion_detail/uom_conversion_detail.txt | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/buying/utils.py b/buying/utils.py index 886b460e93..d7db1d5fa2 100644 --- a/buying/utils.py +++ b/buying/utils.py @@ -207,7 +207,7 @@ def get_last_purchase_details(item_code, doc_name, conversion_rate=1.0): @webnotes.whitelist() def get_conversion_factor(item_code, uom): return {"conversion_factor": webnotes.conn.get_value("UOM Conversion Detail", - {"parent": item_code, "uom": uom})} + {"parent": item_code, "uom": uom}, "conversion_factor")} @webnotes.whitelist() def get_projected_qty(item_code, warehouse): diff --git a/stock/doctype/uom_conversion_detail/uom_conversion_detail.txt b/stock/doctype/uom_conversion_detail/uom_conversion_detail.txt index 8b35f64cfb..d775513cd4 100644 --- a/stock/doctype/uom_conversion_detail/uom_conversion_detail.txt +++ b/stock/doctype/uom_conversion_detail/uom_conversion_detail.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:28:04", "docstatus": 0, - "modified": "2013-07-10 14:54:25", + "modified": "2013-07-22 17:17:53", "modified_by": "Administrator", "owner": "Administrator" }, @@ -15,6 +15,7 @@ }, { "doctype": "DocField", + "in_list_view": 1, "name": "__common__", "parent": "UOM Conversion Detail", "parentfield": "fields", @@ -29,7 +30,6 @@ "doctype": "DocField", "fieldname": "uom", "fieldtype": "Link", - "in_list_view": 0, "label": "UOM", "oldfieldname": "uom", "oldfieldtype": "Link", @@ -39,7 +39,6 @@ "doctype": "DocField", "fieldname": "conversion_factor", "fieldtype": "Float", - "in_list_view": 1, "label": "Conversion Factor", "oldfieldname": "conversion_factor", "oldfieldtype": "Float"