From 9e95f8c201a59c720f45b4c21ef7a77796dd6be6 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 5 Dec 2012 11:06:00 +0530 Subject: [PATCH 1/4] 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) From 247a8f2693487969035a109f6a7f04d35fb03b5d Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 5 Dec 2012 11:06:19 +0530 Subject: [PATCH 2/4] latest updates page --- home/page/latest_updates/latest_updates.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/home/page/latest_updates/latest_updates.js b/home/page/latest_updates/latest_updates.js index 4d5f2bfd94..8392a69e39 100644 --- a/home/page/latest_updates/latest_updates.js +++ b/home/page/latest_updates/latest_updates.js @@ -1,5 +1,12 @@ erpnext.updates = [ - ["4rd December 2012", [ + ["5th December 2012", [ + "[For indian customer only] Deprecated TDS related documents and fields. Old TDS amount added into tax table in Purchase Invoice and entries table in case of JV", + "Production Planning Tool: The field 'Allow SA items as raw material' has been renamed to 'Use multi-level BOM', 'Include in plan' column from SO table has been deleted", + "Production Order is now linked with sales order.", + "Batch nos are now filtered with item and available qty", + "BOM: 'Update Costing' button has been deleted, once submitted cost are fixed." + ]], + ["4th December 2012", [ "POS / Mode of Payment: Select default bank / cash account in Mode of Payment and it will be automatically selected in POS Invoice.", "Email: Add contact name as 'Dear so-and-so' in Email.", "Report Builder: Remember last column setup for users", @@ -9,6 +16,7 @@ erpnext.updates = [ "Linked With: Added new Linked with in all Forms.", "Rename Tool: Documents that can be renamed will have a 'Rename' option in the sidebar (wherever applicable).", "Chart of Accounts: Ability to rename / delete from Chart of Accounts.", + "Delivery and Billing status now updated in sales order, if POS made against that sales order" ]], ["30th November 2012", [ "Auto Notifications: System will prompt user with pre-set message for auto-notification.", From ff4d616133d59567a4416cc68eb603c1a45e5cdf Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 5 Dec 2012 11:11:22 +0530 Subject: [PATCH 3/4] latest update --- home/page/latest_updates/latest_updates.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/home/page/latest_updates/latest_updates.js b/home/page/latest_updates/latest_updates.js index 8392a69e39..09befee8ac 100644 --- a/home/page/latest_updates/latest_updates.js +++ b/home/page/latest_updates/latest_updates.js @@ -1,10 +1,10 @@ erpnext.updates = [ ["5th December 2012", [ - "[For indian customer only] Deprecated TDS related documents and fields. Old TDS amount added into tax table in Purchase Invoice and entries table in case of JV", - "Production Planning Tool: The field 'Allow SA items as raw material' has been renamed to 'Use multi-level BOM', 'Include in plan' column from SO table has been deleted", "Production Order is now linked with sales order.", + "Production Planning Tool: The field 'Allow SA items as raw material' has been renamed to 'Use multi-level BOM', 'Include in plan' column from SO table has been deleted", "Batch nos are now filtered with item and available qty", - "BOM: 'Update Costing' button has been deleted, once submitted cost are fixed." + "BOM: 'Update Costing' button has been deleted, once submitted cost are fixed.", + "[For indian customer only] Deprecated TDS related documents and fields. Old TDS amount added into tax table in Purchase Invoice and entries table in case of JV", ]], ["4th December 2012", [ "POS / Mode of Payment: Select default bank / cash account in Mode of Payment and it will be automatically selected in POS Invoice.", From 1ad42f09df3beacbcd5095b8281daa73dbe82646 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 5 Dec 2012 12:36:19 +0530 Subject: [PATCH 4/4] bom fixes: item selection before server call --- .../doctype/sales_invoice/sales_invoice.js | 2 +- .../doctype/sales_invoice/sales_invoice.py | 2 +- production/doctype/bom/bom.js | 59 +++++++++++-------- production/doctype/bom/bom.py | 13 ++-- 4 files changed, 44 insertions(+), 32 deletions(-) diff --git a/accounts/doctype/sales_invoice/sales_invoice.js b/accounts/doctype/sales_invoice/sales_invoice.js index 48f9e96194..ca3a2ae14f 100644 --- a/accounts/doctype/sales_invoice/sales_invoice.js +++ b/accounts/doctype/sales_invoice/sales_invoice.js @@ -162,7 +162,7 @@ cur_frm.cscript.update_stock = function(doc, dt, dn) { cur_frm.cscript.warehouse = function(doc, cdt , cdn) { var d = locals[cdt][cdn]; - if (!d.item_code) {alert("please enter item code first"); return}; + if (!d.item_code) { msgprint("please enter item code first"); return }; if (d.warehouse) { arg = "{'item_code':'" + d.item_code + "','warehouse':'" + d.warehouse +"'}"; get_server_fields('get_actual_qty',arg,'entries',doc,cdt,cdn,1); diff --git a/accounts/doctype/sales_invoice/sales_invoice.py b/accounts/doctype/sales_invoice/sales_invoice.py index 6b70d649ae..00a5bfae7b 100644 --- a/accounts/doctype/sales_invoice/sales_invoice.py +++ b/accounts/doctype/sales_invoice/sales_invoice.py @@ -902,7 +902,7 @@ def assign_task_to_owner(inv, msg, users): def get_bank_cash_account(mode_of_payment): val = webnotes.conn.get_value("Mode of Payment", mode_of_payment, "default_account") if not val: - webnotes.msgprint("Default Account not set in Mode of Payment: ") + webnotes.msgprint("Default Account not set in Mode of Payment: %s" % mode_of_payment) return { "cash_bank_account": val } \ No newline at end of file diff --git a/production/doctype/bom/bom.js b/production/doctype/bom/bom.js index aef14a9d5f..9dffd6cb32 100644 --- a/production/doctype/bom/bom.js +++ b/production/doctype/bom/bom.js @@ -8,11 +8,11 @@ // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with this program. If not, see . +// along with this program. If not, see . // On REFRESH cur_frm.cscript.refresh = function(doc,dt,dn){ @@ -50,33 +50,42 @@ cur_frm.cscript.hour_rate = function(doc, dt, dn) { cur_frm.cscript.time_in_mins = cur_frm.cscript.hour_rate; -cur_frm.cscript.item_code = function(doc,dt,dn) { - get_bom_material_detail(doc, dt, dn); +cur_frm.cscript.item_code = function(doc, cdt, cdn) { + get_bom_material_detail(doc, cdt, cdn); } -cur_frm.cscript.bom_no = function(doc,dt,dn) { - get_bom_material_detail(doc, dt, dn); +cur_frm.cscript.bom_no = function(doc, cdt, cdn) { + get_bom_material_detail(doc, cdt, cdn); } - -var get_bom_material_detail= function(doc,dt,dn) { - var d = locals[dt][dn]; - var callback = function(doc, dt, dn) { - calculate_rm_cost(doc, dt, dn); - calculate_total(doc); - } - - var bom_no = (d.bom_no!=null) ? d.bom_no: '' +var get_bom_material_detail= function(doc, cdt, cdn) { + var d = locals[cdt][cdn]; 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); + wn.call({ + doc: cur_frm.doc, + method: "get_bom_material_detail", + args: { + 'item_code': d.item_code, + 'bom_no': d.bom_no != null ? d.bom_no: '', + 'qty': d.qty + }, + callback: function(r) { + d = locals[cdt][cdn]; + $.extend(d, r.message); + refresh_field("bom_materials"); + doc = locals[doc.doctype][doc.name]; + calculate_rm_cost(doc, cdt, cdn); + calculate_total(doc); + }, + freeze: true + }); } } -cur_frm.cscript.qty = function(doc, dt, dn) { - calculate_rm_cost(doc, dt, dn); +cur_frm.cscript.qty = function(doc, cdt, cdn) { + calculate_rm_cost(doc, cdt, cdn); calculate_total(doc); } @@ -84,9 +93,9 @@ cur_frm.cscript.qty = function(doc, dt, dn) { cur_frm.cscript.rate = cur_frm.cscript.qty; -cur_frm.cscript.is_default = function(doc, dt, dn) { +cur_frm.cscript.is_default = function(doc, cdt, cdn) { if (doc.docstatus == 1) - $c_obj(make_doclist(dt, dn), 'manage_default_bom', '', ''); + $c_obj(make_doclist(cdt, cdn), 'manage_default_bom', '', ''); } @@ -97,11 +106,11 @@ cur_frm.cscript.is_active = function(doc, dt, dn) { // Calculate Operating Cost -var calculate_op_cost = function(doc, dt, dn) { +var calculate_op_cost = function(doc, dt, dn) { var op = getchildren('BOM Operation', doc.name, 'bom_operations'); total_op_cost = 0; for(var i=0;i