From dd6ebc1a4daf2c1f6c2fc5aee2f1c06c65982bcd Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Tue, 15 Oct 2013 15:54:31 +0530 Subject: [PATCH] [cleanup] comminified copy_account_in_all_row and removed conversion rate from pos setting --- accounts/doctype/sales_invoice/sales_invoice.js | 11 ----------- docs/user/setup/docs.user.setup.price_list.md | 2 +- public/js/controllers/stock_controller.js | 12 ++++++++++++ stock/doctype/stock_entry/stock_entry.js | 11 ----------- stock/doctype/stock_entry/stock_entry.py | 8 ++++---- .../stock_entry_detail/stock_entry_detail.txt | 3 ++- 6 files changed, 19 insertions(+), 28 deletions(-) diff --git a/accounts/doctype/sales_invoice/sales_invoice.js b/accounts/doctype/sales_invoice/sales_invoice.js index 4d4f4b7ee0..e980f0a2bc 100644 --- a/accounts/doctype/sales_invoice/sales_invoice.js +++ b/accounts/doctype/sales_invoice/sales_invoice.js @@ -382,17 +382,6 @@ cur_frm.cscript.cost_center = function(doc, cdt, cdn) { cur_frm.cscript.copy_account_in_all_row(doc, cdt, cdn, "cost_center"); } -cur_frm.cscript.copy_account_in_all_row = function(doc, cdt, cdn, fieldname) { - var d = locals[cdt][cdn]; - if(d[fieldname]){ - var cl = getchildren('Sales Invoice Item', doc.name, cur_frm.cscript.fname, doc.doctype); - for(var i = 0; i < cl.length; i++) { - if(!cl[i][fieldname]) cl[i][fieldname] = d[fieldname]; - } - } - refresh_field(cur_frm.cscript.fname); -} - cur_frm.cscript.on_submit = function(doc, cdt, cdn) { if(cint(wn.boot.notification_settings.sales_invoice)) { cur_frm.email_doc(wn.boot.notification_settings.sales_invoice_message); diff --git a/docs/user/setup/docs.user.setup.price_list.md b/docs/user/setup/docs.user.setup.price_list.md index 7214fff514..a1fbf89a1e 100644 --- a/docs/user/setup/docs.user.setup.price_list.md +++ b/docs/user/setup/docs.user.setup.price_list.md @@ -20,7 +20,7 @@ An Item can have multiple prices based on customer, currency, region, shipping c > Setup > Item Price -- Enter Price List and Item Code, Valid for Buying or Selling, Item Name & Item Description will be automatically fetched. +- Enter Price List and Item Code, Valid for Buying or Selling, Item Name and Item Description will be automatically fetched. - Enter Rate and save the document. ![Item-Price](img/item-price.png) diff --git a/public/js/controllers/stock_controller.js b/public/js/controllers/stock_controller.js index e4b03191a1..de18fe0b57 100644 --- a/public/js/controllers/stock_controller.js +++ b/public/js/controllers/stock_controller.js @@ -18,6 +18,7 @@ erpnext.stock.StockController = wn.ui.form.Controller.extend({ } }, + show_general_ledger: function() { var me = this; if(this.frm.doc.docstatus===1 && cint(wn.defaults.get_default("auto_accounting_for_stock"))) { @@ -30,5 +31,16 @@ erpnext.stock.StockController = wn.ui.form.Controller.extend({ wn.set_route("general-ledger"); }); } + }, + + copy_account_in_all_row: function(doc, dt, dn, fieldname) { + var d = locals[dt][dn]; + if(d[fieldname]){ + var cl = getchildren(this.frm.cscript.tname, doc.name, this.frm.cscript.fname, doc.doctype); + for(var i = 0; i < cl.length; i++) { + if(!cl[i][fieldname]) cl[i][fieldname] = d[fieldname]; + } + } + refresh_field(this.frm.cscript.fname); } }); \ No newline at end of file diff --git a/stock/doctype/stock_entry/stock_entry.js b/stock/doctype/stock_entry/stock_entry.js index 26ad62925a..7301bd5b1a 100644 --- a/stock/doctype/stock_entry/stock_entry.js +++ b/stock/doctype/stock_entry/stock_entry.js @@ -378,17 +378,6 @@ cur_frm.cscript.cost_center = function(doc, cdt, cdn) { cur_frm.cscript.copy_account_in_all_row(doc, cdt, cdn, "cost_center"); } -cur_frm.cscript.copy_account_in_all_row = function(doc, cdt, cdn, fieldname) { - var d = locals[cdt][cdn]; - if(d[fieldname]){ - var cl = getchildren('Stock Entry Detail', doc.name, cur_frm.cscript.fname, doc.doctype); - for(var i = 0; i < cl.length; i++) { - if(!cl[i][fieldname]) cl[i][fieldname] = d[fieldname]; - } - } - refresh_field(cur_frm.cscript.fname); -} - cur_frm.fields_dict.customer.get_query = function(doc, cdt, cdn) { return{ query:"controllers.queries.customer_query" } } diff --git a/stock/doctype/stock_entry/stock_entry.py b/stock/doctype/stock_entry/stock_entry.py index 735584685a..9470b221b0 100644 --- a/stock/doctype/stock_entry/stock_entry.py +++ b/stock/doctype/stock_entry/stock_entry.py @@ -368,7 +368,7 @@ class DocType(StockController): def get_item_details(self, arg): arg = json.loads(arg) - + item = sql("""select stock_uom, description, item_name, purchase_account, cost_center from `tabItem` where name = %s and (ifnull(end_of_life,'')='' or end_of_life ='0000-00-00' @@ -381,9 +381,9 @@ class DocType(StockController): 'stock_uom' : item and item[0]['stock_uom'] or '', 'description' : item and item[0]['description'] or '', 'item_name' : item and item[0]['item_name'] or '', - 'expense_account' : item and item[0]['purchase_account'] or arg["expense_account"] \ - or webnotes.conn.get_value("Company", arg["company"], "default_expense_account"), - 'cost_center' : item and item[0]['cost_center'] or arg["cost_center"], + 'expense_account' : item and item[0]['purchase_account'] or arg.get("expense_account") \ + or webnotes.conn.get_value("Company", arg.get("company"), "default_expense_account"), + 'cost_center' : item and item[0]['cost_center'] or arg.get("cost_center"), 'qty' : 0, 'transfer_qty' : 0, 'conversion_factor' : 1, diff --git a/stock/doctype/stock_entry_detail/stock_entry_detail.txt b/stock/doctype/stock_entry_detail/stock_entry_detail.txt index b400cdd248..b766250670 100644 --- a/stock/doctype/stock_entry_detail/stock_entry_detail.txt +++ b/stock/doctype/stock_entry_detail/stock_entry_detail.txt @@ -2,7 +2,7 @@ { "creation": "2013-03-29 18:22:12", "docstatus": 0, - "modified": "2013-08-28 19:25:38", + "modified": "2013-10-15 14:58:09", "modified_by": "Administrator", "owner": "Administrator" }, @@ -154,6 +154,7 @@ "print_hide": 1 }, { + "default": ":Company", "depends_on": "eval:sys_defaults.auto_accounting_for_stock", "doctype": "DocField", "fieldname": "cost_center",