Minor fixes in company and account
diff --git a/erpnext/accounts/doctype/account/account.json b/erpnext/accounts/doctype/account/account.json
index 85ab439..ec9f7ae 100644
--- a/erpnext/accounts/doctype/account/account.json
+++ b/erpnext/accounts/doctype/account/account.json
@@ -1,7 +1,7 @@
{
"allow_copy": 1,
"allow_rename": 1,
- "creation": "2013-01-30 12:49:46.000000",
+ "creation": "2013-01-30 12:49:46",
"description": "Heads (or groups) against which Accounting Entries are made and balances are maintained.",
"docstatus": 0,
"doctype": "DocType",
@@ -10,6 +10,7 @@
{
"fieldname": "properties",
"fieldtype": "Section Break",
+ "in_list_view": 1,
"label": "Account Details",
"oldfieldtype": "Section Break",
"permlevel": 0
@@ -17,6 +18,7 @@
{
"fieldname": "column_break0",
"fieldtype": "Column Break",
+ "in_list_view": 1,
"permlevel": 0,
"width": "50%"
},
@@ -24,6 +26,7 @@
"fieldname": "account_name",
"fieldtype": "Data",
"in_filter": 1,
+ "in_list_view": 1,
"label": "Account Name",
"no_copy": 1,
"oldfieldname": "account_name",
@@ -37,6 +40,7 @@
"fieldname": "level",
"fieldtype": "Int",
"hidden": 1,
+ "in_list_view": 1,
"label": "Level",
"oldfieldname": "level",
"oldfieldtype": "Int",
@@ -49,6 +53,7 @@
"fieldname": "group_or_ledger",
"fieldtype": "Select",
"in_filter": 1,
+ "in_list_view": 1,
"label": "Group or Ledger",
"oldfieldname": "group_or_ledger",
"oldfieldtype": "Select",
@@ -103,7 +108,7 @@
"label": "Account Type",
"oldfieldname": "account_type",
"oldfieldtype": "Select",
- "options": "Bank\nCash\nTax\nChargeable\nWarehouse\nReceivable\nPayable\nEquity\nFixed Asset\nCost of Goods Sold\nExpense Account\nIncome Account\nStock Received But Not Billed\nExpenses Included In Valuation\nStock Adjustment",
+ "options": "\nBank\nCash\nTax\nChargeable\nWarehouse\nReceivable\nPayable\nEquity\nFixed Asset\nCost of Goods Sold\nExpense Account\nIncome Account\nStock Received But Not Billed\nExpenses Included In Valuation\nStock Adjustment",
"permlevel": 0,
"search_index": 0
},
@@ -206,7 +211,7 @@
"icon": "icon-money",
"idx": 1,
"in_create": 1,
- "modified": "2014-03-19 12:07:27.000000",
+ "modified": "2014-04-28 16:52:32.059072",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Account",
diff --git a/erpnext/patches/4_0/countrywise_coa.py b/erpnext/patches/4_0/countrywise_coa.py
index d740118..f11bdb7 100644
--- a/erpnext/patches/4_0/countrywise_coa.py
+++ b/erpnext/patches/4_0/countrywise_coa.py
@@ -7,23 +7,23 @@
def execute():
frappe.reload_doc("setup", 'doctype', "company")
frappe.reload_doc("accounts", 'doctype', "account")
-
- frappe.db.sql("""update tabAccount set account_type='Cash'
+
+ frappe.db.sql("""update tabAccount set account_type='Cash'
where account_type='Bank or Cash' and account_name in ('Cash', 'Cash In Hand')""")
-
- frappe.db.sql("""update tabAccount set account_type='Stock'
+
+ frappe.db.sql("""update tabAccount set account_type='Stock'
where account_name = 'Stock Assets'""")
-
+
ac_types = {"Fixed Asset Account": "Fixed Asset", "Bank or Cash": "Bank"}
for old, new in ac_types.items():
- frappe.db.sql("""update tabAccount set account_type=%s
- where account_type=%s""", (new, old))
+ frappe.db.sql("""update tabAccount set account_type=%s
+ where account_type=%s""", (new, old))
try:
- frappe.db.sql("""update `tabAccount` set report_type =
+ frappe.db.sql("""update `tabAccount` set report_type =
if(is_pl_account='Yes', 'Profit and Loss', 'Balance Sheet')""")
-
- frappe.db.sql("""update `tabAccount` set balance_must_be=debit_or_credit
+
+ frappe.db.sql("""update `tabAccount` set balance_must_be=debit_or_credit
where ifnull(allow_negative_balance, 0) = 0""")
except:
pass
diff --git a/erpnext/setup/doctype/company/company.json b/erpnext/setup/doctype/company/company.json
index 555d0f1..489c4c1 100644
--- a/erpnext/setup/doctype/company/company.json
+++ b/erpnext/setup/doctype/company/company.json
@@ -2,7 +2,7 @@
"allow_import": 1,
"allow_rename": 1,
"autoname": "field:company_name",
- "creation": "2013-04-10 08:35:39.000000",
+ "creation": "2013-04-10 08:35:39",
"description": "Legal Entity / Subsidiary with a separate Chart of Accounts belonging to the Organization.",
"docstatus": 0,
"doctype": "DocType",
@@ -56,6 +56,7 @@
{
"fieldname": "charts_section",
"fieldtype": "Section Break",
+ "hidden": 1,
"label": "Chart of Accounts",
"permlevel": 0
},
@@ -345,7 +346,7 @@
],
"icon": "icon-building",
"idx": 1,
- "modified": "2014-03-05 14:54:29.000000",
+ "modified": "2014-04-28 16:49:05.832905",
"modified_by": "Administrator",
"module": "Setup",
"name": "Company",
diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py
index 0149877..87116b5 100644
--- a/erpnext/setup/doctype/company/company.py
+++ b/erpnext/setup/doctype/company/company.py
@@ -93,25 +93,20 @@
account.insert()
def set_default_accounts(self):
- def _set_default_accounts(accounts):
- for field, account_type in accounts.items():
- account = frappe.db.get_value("Account", {"account_type": account_type,
- "group_or_ledger": "Ledger", "company": self.name})
+ def _set_default_account(fieldname, account_type):
+ account = frappe.db.get_value("Account", {"account_type": account_type,
+ "group_or_ledger": "Ledger", "company": self.name})
- if account and not self.get(field):
- frappe.db.set(self, field, account)
+ if account and not self.get(fieldname):
+ self.db_set(fieldname, account)
- _set_default_accounts({
- "default_cash_account": _("Cash"),
- "default_bank_account": _("Bank")
- })
+ _set_default_account("default_cash_account", "Cash")
+ _set_default_account("default_bank_account", "Bank")
if cint(frappe.db.get_value("Accounts Settings", None, "auto_accounting_for_stock")):
- _set_default_accounts({
- "stock_received_but_not_billed": _("Stock Received But Not Billed"),
- "stock_adjustment_account": _("Stock Adjustment"),
- "expenses_included_in_valuation": _("Expenses Included In Valuation")
- })
+ _set_default_account("stock_received_but_not_billed", "Stock Received But Not Billed")
+ _set_default_account("stock_adjustment_account", "Stock Adjustment")
+ _set_default_account("expenses_included_in_valuation", "Expenses Included In Valuation")
def create_default_cost_center(self):
cc_list = [