From d015195617d906430de8cf00bb149b54d12fffe1 Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Tue, 9 Jun 2015 15:21:50 +0530 Subject: [PATCH] fixes in barcode --- erpnext/public/js/controllers/transaction.js | 9 +++++++++ erpnext/selling/sales_common.js | 9 --------- .../doctype/purchase_receipt/purchase_receipt.js | 15 --------------- 3 files changed, 9 insertions(+), 24 deletions(-) diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index e05245e7b0..ca0a6cb8d2 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -105,6 +105,15 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ } }, + barcode: function(doc, cdt, cdn) { + var d = locals[cdt][cdn]; + if(d.barcode=="" || d.barcode==null) { + // barcode cleared, remove item + d.item_code = ""; + } + this.item_code(doc, cdt, cdn); + }, + item_code: function(doc, cdt, cdn) { var me = this; var item = frappe.get_doc(cdt, cdn); diff --git a/erpnext/selling/sales_common.js b/erpnext/selling/sales_common.js index 3ef85257f3..775eb4143f 100644 --- a/erpnext/selling/sales_common.js +++ b/erpnext/selling/sales_common.js @@ -124,15 +124,6 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ this.apply_pricing_rule(); }, - barcode: function(doc, cdt, cdn) { - var d = locals[cdt][cdn]; - if(d.barcode=="" || d.barcode==null) { - // barcode cleared, remove item - d.item_code = ""; - } - this.item_code(doc, cdt, cdn); - }, - selling_price_list: function() { this.apply_price_list(); }, diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js index c85123c2ed..fe41b4fb93 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js @@ -204,18 +204,3 @@ frappe.ui.form.on("Purchase Receipt", "is_subcontracted", function(frm) { } frm.toggle_reqd("supplier_warehouse", frm.doc.is_subcontracted==="Yes"); }); - -cur_frm.cscript.barcode = function(doc, cdt, cdn) { - var d = locals[cdt][cdn]; - if (d.barcode) { - frappe.call({ - method: "erpnext.stock.get_item_details.get_item_code", - args: {"barcode": d.barcode }, - callback: function(r) { - if (!r.exe){ - frappe.model.set_value(cdt, cdn, "item_code", r.message); - } - } - }); - } -} \ No newline at end of file