Minor fixes in company and account
This commit is contained in:
parent
2594e41462
commit
985918d42b
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"allow_copy": 1,
|
"allow_copy": 1,
|
||||||
"allow_rename": 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.",
|
"description": "Heads (or groups) against which Accounting Entries are made and balances are maintained.",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"doctype": "DocType",
|
"doctype": "DocType",
|
||||||
@ -10,6 +10,7 @@
|
|||||||
{
|
{
|
||||||
"fieldname": "properties",
|
"fieldname": "properties",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
|
"in_list_view": 1,
|
||||||
"label": "Account Details",
|
"label": "Account Details",
|
||||||
"oldfieldtype": "Section Break",
|
"oldfieldtype": "Section Break",
|
||||||
"permlevel": 0
|
"permlevel": 0
|
||||||
@ -17,6 +18,7 @@
|
|||||||
{
|
{
|
||||||
"fieldname": "column_break0",
|
"fieldname": "column_break0",
|
||||||
"fieldtype": "Column Break",
|
"fieldtype": "Column Break",
|
||||||
|
"in_list_view": 1,
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"width": "50%"
|
"width": "50%"
|
||||||
},
|
},
|
||||||
@ -24,6 +26,7 @@
|
|||||||
"fieldname": "account_name",
|
"fieldname": "account_name",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"in_filter": 1,
|
"in_filter": 1,
|
||||||
|
"in_list_view": 1,
|
||||||
"label": "Account Name",
|
"label": "Account Name",
|
||||||
"no_copy": 1,
|
"no_copy": 1,
|
||||||
"oldfieldname": "account_name",
|
"oldfieldname": "account_name",
|
||||||
@ -37,6 +40,7 @@
|
|||||||
"fieldname": "level",
|
"fieldname": "level",
|
||||||
"fieldtype": "Int",
|
"fieldtype": "Int",
|
||||||
"hidden": 1,
|
"hidden": 1,
|
||||||
|
"in_list_view": 1,
|
||||||
"label": "Level",
|
"label": "Level",
|
||||||
"oldfieldname": "level",
|
"oldfieldname": "level",
|
||||||
"oldfieldtype": "Int",
|
"oldfieldtype": "Int",
|
||||||
@ -49,6 +53,7 @@
|
|||||||
"fieldname": "group_or_ledger",
|
"fieldname": "group_or_ledger",
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
"in_filter": 1,
|
"in_filter": 1,
|
||||||
|
"in_list_view": 1,
|
||||||
"label": "Group or Ledger",
|
"label": "Group or Ledger",
|
||||||
"oldfieldname": "group_or_ledger",
|
"oldfieldname": "group_or_ledger",
|
||||||
"oldfieldtype": "Select",
|
"oldfieldtype": "Select",
|
||||||
@ -103,7 +108,7 @@
|
|||||||
"label": "Account Type",
|
"label": "Account Type",
|
||||||
"oldfieldname": "account_type",
|
"oldfieldname": "account_type",
|
||||||
"oldfieldtype": "Select",
|
"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,
|
"permlevel": 0,
|
||||||
"search_index": 0
|
"search_index": 0
|
||||||
},
|
},
|
||||||
@ -206,7 +211,7 @@
|
|||||||
"icon": "icon-money",
|
"icon": "icon-money",
|
||||||
"idx": 1,
|
"idx": 1,
|
||||||
"in_create": 1,
|
"in_create": 1,
|
||||||
"modified": "2014-03-19 12:07:27.000000",
|
"modified": "2014-04-28 16:52:32.059072",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Account",
|
"name": "Account",
|
||||||
|
|||||||
@ -7,23 +7,23 @@ import frappe
|
|||||||
def execute():
|
def execute():
|
||||||
frappe.reload_doc("setup", 'doctype', "company")
|
frappe.reload_doc("setup", 'doctype', "company")
|
||||||
frappe.reload_doc("accounts", 'doctype', "account")
|
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')""")
|
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'""")
|
where account_name = 'Stock Assets'""")
|
||||||
|
|
||||||
ac_types = {"Fixed Asset Account": "Fixed Asset", "Bank or Cash": "Bank"}
|
ac_types = {"Fixed Asset Account": "Fixed Asset", "Bank or Cash": "Bank"}
|
||||||
for old, new in ac_types.items():
|
for old, new in ac_types.items():
|
||||||
frappe.db.sql("""update tabAccount set account_type=%s
|
frappe.db.sql("""update tabAccount set account_type=%s
|
||||||
where account_type=%s""", (new, old))
|
where account_type=%s""", (new, old))
|
||||||
|
|
||||||
try:
|
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')""")
|
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""")
|
where ifnull(allow_negative_balance, 0) = 0""")
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
"allow_import": 1,
|
"allow_import": 1,
|
||||||
"allow_rename": 1,
|
"allow_rename": 1,
|
||||||
"autoname": "field:company_name",
|
"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.",
|
"description": "Legal Entity / Subsidiary with a separate Chart of Accounts belonging to the Organization.",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"doctype": "DocType",
|
"doctype": "DocType",
|
||||||
@ -56,6 +56,7 @@
|
|||||||
{
|
{
|
||||||
"fieldname": "charts_section",
|
"fieldname": "charts_section",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
|
"hidden": 1,
|
||||||
"label": "Chart of Accounts",
|
"label": "Chart of Accounts",
|
||||||
"permlevel": 0
|
"permlevel": 0
|
||||||
},
|
},
|
||||||
@ -345,7 +346,7 @@
|
|||||||
],
|
],
|
||||||
"icon": "icon-building",
|
"icon": "icon-building",
|
||||||
"idx": 1,
|
"idx": 1,
|
||||||
"modified": "2014-03-05 14:54:29.000000",
|
"modified": "2014-04-28 16:49:05.832905",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Setup",
|
"module": "Setup",
|
||||||
"name": "Company",
|
"name": "Company",
|
||||||
|
|||||||
@ -93,25 +93,20 @@ class Company(Document):
|
|||||||
account.insert()
|
account.insert()
|
||||||
|
|
||||||
def set_default_accounts(self):
|
def set_default_accounts(self):
|
||||||
def _set_default_accounts(accounts):
|
def _set_default_account(fieldname, account_type):
|
||||||
for field, account_type in accounts.items():
|
account = frappe.db.get_value("Account", {"account_type": account_type,
|
||||||
account = frappe.db.get_value("Account", {"account_type": account_type,
|
"group_or_ledger": "Ledger", "company": self.name})
|
||||||
"group_or_ledger": "Ledger", "company": self.name})
|
|
||||||
|
|
||||||
if account and not self.get(field):
|
if account and not self.get(fieldname):
|
||||||
frappe.db.set(self, field, account)
|
self.db_set(fieldname, account)
|
||||||
|
|
||||||
_set_default_accounts({
|
_set_default_account("default_cash_account", "Cash")
|
||||||
"default_cash_account": _("Cash"),
|
_set_default_account("default_bank_account", "Bank")
|
||||||
"default_bank_account": _("Bank")
|
|
||||||
})
|
|
||||||
|
|
||||||
if cint(frappe.db.get_value("Accounts Settings", None, "auto_accounting_for_stock")):
|
if cint(frappe.db.get_value("Accounts Settings", None, "auto_accounting_for_stock")):
|
||||||
_set_default_accounts({
|
_set_default_account("stock_received_but_not_billed", "Stock Received But Not Billed")
|
||||||
"stock_received_but_not_billed": _("Stock Received But Not Billed"),
|
_set_default_account("stock_adjustment_account", "Stock Adjustment")
|
||||||
"stock_adjustment_account": _("Stock Adjustment"),
|
_set_default_account("expenses_included_in_valuation", "Expenses Included In Valuation")
|
||||||
"expenses_included_in_valuation": _("Expenses Included In Valuation")
|
|
||||||
})
|
|
||||||
|
|
||||||
def create_default_cost_center(self):
|
def create_default_cost_center(self):
|
||||||
cc_list = [
|
cc_list = [
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user