From bc7efa6da6ebef1de76dc9a5ad08918e31e45ee7 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 3 Jun 2014 18:33:20 +0530 Subject: [PATCH 1/3] Parent account mandatory for all non-root accounts --- erpnext/accounts/doctype/account/account.json | 3 ++- erpnext/setup/doctype/company/company.py | 2 ++ erpnext/stock/doctype/warehouse/warehouse.py | 3 +-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/doctype/account/account.json b/erpnext/accounts/doctype/account/account.json index 28a0329e54..dc83351034 100644 --- a/erpnext/accounts/doctype/account/account.json +++ b/erpnext/accounts/doctype/account/account.json @@ -80,6 +80,7 @@ "oldfieldtype": "Link", "options": "Account", "permlevel": 0, + "reqd": 1, "search_index": 1 }, { @@ -209,7 +210,7 @@ "icon": "icon-money", "idx": 1, "in_create": 1, - "modified": "2014-05-21 11:42:47.255511", + "modified": "2014-06-03 18:27:58.109303", "modified_by": "Administrator", "module": "Accounts", "name": "Account", diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py index 2c019d9eb5..789a7f12c7 100644 --- a/erpnext/setup/doctype/company/company.py +++ b/erpnext/setup/doctype/company/company.py @@ -91,6 +91,8 @@ class Company(Document): for d in self.fld_dict.keys(): account.set(d, (d == 'parent_account' and lst[self.fld_dict[d]]) and lst[self.fld_dict[d]] +' - '+ self.abbr or lst[self.fld_dict[d]]) + if not account.parent_account: + account.ignore_mandatory = True account.insert() def set_default_accounts(self): diff --git a/erpnext/stock/doctype/warehouse/warehouse.py b/erpnext/stock/doctype/warehouse/warehouse.py index cc61d5654e..2b6892890a 100644 --- a/erpnext/stock/doctype/warehouse/warehouse.py +++ b/erpnext/stock/doctype/warehouse/warehouse.py @@ -38,8 +38,7 @@ class Warehouse(Document): def create_account_head(self): if cint(frappe.defaults.get_global_default("auto_accounting_for_stock")): if not frappe.db.get_value("Account", {"account_type": "Warehouse", - "master_name": self.name}) and not frappe.db.get_value("Account", - {"account_name": self.warehouse_name}): + "master_name": self.name}): if self.get("__islocal") or not frappe.db.get_value( "Stock Ledger Entry", {"warehouse": self.name}): self.validate_parent_account() From ce6977ffe6f732fbd061b5a4cfd6b51d36aa8c17 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 3 Jun 2014 23:01:31 +0530 Subject: [PATCH 2/3] Minor fixes in fetching item details --- erpnext/stock/get_item_details.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py index 4a295d8242..9c251b8b29 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -255,6 +255,7 @@ def apply_pricing_rule(args): args = frappe._dict(args) out = frappe._dict() + if not args.get("item_code"): return if not args.get("item_group") or not args.get("brand"): args.item_group, args.brand = frappe.db.get_value("Item", From 67d8b91690467575bf2c140b70338a79e2369e68 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 4 Jun 2014 11:18:25 +0530 Subject: [PATCH 3/3] Fixes in bank reconciliation statement --- .../bank_reconciliation_statement.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py b/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py index c1072a30ff..e87fbd3226 100644 --- a/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py +++ b/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py @@ -22,7 +22,7 @@ def execute(filters=None): total_debit += flt(d[4]) total_credit += flt(d[5]) - bank_bal = flt(balance_as_per_company) + flt(total_debit) - flt(total_credit) + bank_bal = flt(balance_as_per_company) - flt(total_debit) + flt(total_credit) data += [ get_balance_row("Balance as per company books", balance_as_per_company),