From 9e95f8c201a59c720f45b4c21ef7a77796dd6be6 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 5 Dec 2012 11:06:00 +0530 Subject: [PATCH] fixes in bom --- production/doctype/bom/bom.js | 2 +- production/doctype/bom/bom.py | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/production/doctype/bom/bom.js b/production/doctype/bom/bom.js index dd32fe40d9..aef14a9d5f 100644 --- a/production/doctype/bom/bom.js +++ b/production/doctype/bom/bom.js @@ -67,7 +67,7 @@ var get_bom_material_detail= function(doc,dt,dn) { calculate_total(doc); } - var bom_no = (d.bom_no!=null) ? d.bom_no:'' + var bom_no = (d.bom_no!=null) ? d.bom_no: '' if (d.item_code) { arg = {'item_code': d.item_code, 'bom_no': bom_no, 'qty': d.qty}; get_server_fields('get_bom_material_detail', JSON.stringify(arg), 'bom_materials', doc, dt, dn, 1, callback); diff --git a/production/doctype/bom/bom.py b/production/doctype/bom/bom.py index 0b634d7f64..c0ef31c6e1 100644 --- a/production/doctype/bom/bom.py +++ b/production/doctype/bom/bom.py @@ -31,7 +31,8 @@ class DocType: self.doclist = doclist def autoname(self): - last_name = sql("select max(name) from `tabBOM` where name like 'BOM/%s/%%'" % self.doc.item) + last_name = sql("""select max(name) from `tabBOM` + where name like 'BOM/%s/%%'""" % self.doc.item) if last_name: idx = cint(cstr(last_name[0][0]).split('/')[-1]) + 1 else: @@ -40,9 +41,10 @@ class DocType: def get_item_det(self, item_code): - item = sql("""select name, is_asset_item, is_purchase_item, docstatus, is_sub_contracted_item, - description, stock_uom, default_bom, last_purchase_rate, standard_rate, is_manufactured_item from `tabItem` - where item_code = %s""", item_code, as_dict = 1) + item = sql("""select name, is_asset_item, is_purchase_item, docstatus, + is_sub_contracted_item, description, stock_uom, default_bom, + last_purchase_rate, standard_rate, is_manufactured_item + from `tabItem` where item_code = %s""", item_code, as_dict = 1) return item @@ -86,8 +88,8 @@ class DocType: def get_bom_material_detail(self, arg): """ Get raw material details like uom, desc and rate""" - - arg = eval(arg) + import json + arg = json.loads(arg) item = self.get_item_det(arg['item_code']) self.validate_rm_item(item)