Removed check for duplicate in sales bom, set default income account in Company

This commit is contained in:
Anand Doshi 2014-04-30 18:54:05 +05:30
parent f62da519d6
commit a47bf2ab66
2 changed files with 7 additions and 6 deletions

View File

@ -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() {

View File

@ -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 = [
{