Removed check for duplicate in sales bom, set default income account in Company
diff --git a/erpnext/selling/doctype/sales_bom/sales_bom.js b/erpnext/selling/doctype/sales_bom/sales_bom.js
index 0268b2f..2e0e749 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 87116b5..b409e11 100644
--- a/erpnext/setup/doctype/company/company.py
+++ b/erpnext/setup/doctype/company/company.py
@@ -94,10 +94,13 @@
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 @@
_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 = [
{