Merge pull request #4004 from nabinhait/fix9
[fix] Bypass Root Not Editable validation from Setup Wizard
This commit is contained in:
commit
a1b0ff09a8
@ -7,6 +7,8 @@ from frappe.utils import cstr, cint
|
||||
from frappe import throw, _
|
||||
from frappe.model.document import Document
|
||||
|
||||
class RootNotEditable(frappe.ValidationError): pass
|
||||
|
||||
class Account(Document):
|
||||
nsm_parent_field = 'parent_account'
|
||||
|
||||
@ -67,7 +69,7 @@ class Account(Document):
|
||||
# does not exists parent
|
||||
if frappe.db.exists("Account", self.name):
|
||||
if not frappe.db.get_value("Account", self.name, "parent_account"):
|
||||
throw(_("Root cannot be edited."))
|
||||
throw(_("Root cannot be edited."), RootNotEditable)
|
||||
|
||||
def validate_frozen_accounts_modifier(self):
|
||||
old_value = frappe.db.get_value("Account", self.name, "freeze_account")
|
||||
|
@ -15,6 +15,7 @@ from .default_website import website_maker
|
||||
import install_fixtures
|
||||
from .sample_data import make_sample_data
|
||||
from erpnext.accounts.utils import FiscalYearError
|
||||
from erpnext.accounts.doctype.account.account import RootNotEditable
|
||||
|
||||
@frappe.whitelist()
|
||||
def setup_account(args=None):
|
||||
@ -303,6 +304,7 @@ def get_fy_details(fy_start_date, fy_end_date):
|
||||
return fy
|
||||
|
||||
def create_taxes(args):
|
||||
|
||||
for i in xrange(1,6):
|
||||
if args.get("tax_" + str(i)):
|
||||
# replace % in case someone also enters the % symbol
|
||||
@ -320,6 +322,9 @@ def create_taxes(args):
|
||||
pass
|
||||
else:
|
||||
raise
|
||||
except RootNotEditable, e:
|
||||
pass
|
||||
|
||||
def make_tax_head(args, i, tax_group, tax_rate):
|
||||
return frappe.get_doc({
|
||||
"doctype":"Account",
|
||||
|
Loading…
Reference in New Issue
Block a user