From deb6e06336f49bf0d0aa754e71819a89bd6abd7a Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 4 Jun 2014 17:09:58 +0530 Subject: [PATCH] minor fix --- erpnext/accounts/doctype/account/account.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/erpnext/accounts/doctype/account/account.py b/erpnext/accounts/doctype/account/account.py index e5e2e41feb..4cd4efe86d 100644 --- a/erpnext/accounts/doctype/account/account.py +++ b/erpnext/accounts/doctype/account/account.py @@ -72,12 +72,13 @@ class Account(Document): def validate_balance_must_be_settings(self): from erpnext.accounts.utils import get_balance_on - account_balance = get_balance_on(self.name) + if not self.get("__islocal") and self.balance_must_be: + account_balance = get_balance_on(self.name) - if account_balance > 0 and self.balance_must_be == "Credit": - frappe.throw(_("Account balance already in Debit, you are not allowed to set 'Balance Must Be' as 'Credit'")) - elif account_balance < 0 and self.balance_must_be == "Debit": - frappe.throw(_("Account balance already in Credit, you are not allowed to set 'Balance Must Be' as 'Debit'")) + if account_balance > 0 and self.balance_must_be == "Credit": + frappe.throw(_("Account balance already in Debit, you are not allowed to set 'Balance Must Be' as 'Credit'")) + elif account_balance < 0 and self.balance_must_be == "Debit": + frappe.throw(_("Account balance already in Credit, you are not allowed to set 'Balance Must Be' as 'Debit'")) def convert_group_to_ledger(self): if self.check_if_child_exists():