From a47bf2ab6614aca7a7ef2c10910d7bec31e232d0 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 30 Apr 2014 18:54:05 +0530 Subject: [PATCH] Removed check for duplicate in sales bom, set default income account in Company --- erpnext/selling/doctype/sales_bom/sales_bom.js | 5 ----- erpnext/setup/doctype/company/company.py | 8 +++++++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/erpnext/selling/doctype/sales_bom/sales_bom.js b/erpnext/selling/doctype/sales_bom/sales_bom.js index 0268b2f60e..2e0e749392 100644 --- a/erpnext/selling/doctype/sales_bom/sales_bom.js +++ b/erpnext/selling/doctype/sales_bom/sales_bom.js @@ -3,11 +3,6 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { cur_frm.toggle_enable('new_item_code', doc.__islocal); - if(!doc.__islocal) { - cur_frm.add_custom_button(__("Check for Duplicates"), function() { - return cur_frm.call_server('check_duplicate', 1) - }, 'icon-search') - } } cur_frm.fields_dict.new_item_code.get_query = function() { diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py index 87116b5047..b409e116df 100644 --- a/erpnext/setup/doctype/company/company.py +++ b/erpnext/setup/doctype/company/company.py @@ -94,10 +94,13 @@ class Company(Document): def set_default_accounts(self): def _set_default_account(fieldname, account_type): + if self.get(fieldname): + return + account = frappe.db.get_value("Account", {"account_type": account_type, "group_or_ledger": "Ledger", "company": self.name}) - if account and not self.get(fieldname): + if account: self.db_set(fieldname, account) _set_default_account("default_cash_account", "Cash") @@ -108,6 +111,9 @@ class Company(Document): _set_default_account("stock_adjustment_account", "Stock Adjustment") _set_default_account("expenses_included_in_valuation", "Expenses Included In Valuation") + if not self.default_income_account: + self.db_set("default_income_account", frappe.db.get_value("Account", {"account_name": _("Sales")})) + def create_default_cost_center(self): cc_list = [ {