From 47118ab72ab7bdfb37cb8655b6d010141d00cad4 Mon Sep 17 00:00:00 2001 From: Prateeksha Singh Date: Mon, 26 Nov 2018 16:23:46 +0530 Subject: [PATCH] [setup] remove redundant code - [fix] domain setup from dictionary --- .../operations/install_fixtures.py | 2 +- erpnext/setup/setup_wizard/setup_wizard.py | 49 ------------------- 2 files changed, 1 insertion(+), 50 deletions(-) diff --git a/erpnext/setup/setup_wizard/operations/install_fixtures.py b/erpnext/setup/setup_wizard/operations/install_fixtures.py index 89e8e5552c..2c4bcb377f 100644 --- a/erpnext/setup/setup_wizard/operations/install_fixtures.py +++ b/erpnext/setup/setup_wizard/operations/install_fixtures.py @@ -396,7 +396,7 @@ def install_defaults(args=None): system_settings.save() domain_settings = frappe.get_single('Domain Settings') - domain_settings.set_active_domains([args.domain]) + domain_settings.set_active_domains([args.get('domain')]) stock_settings = frappe.get_doc("Stock Settings") stock_settings.item_naming_by = "Item Code" diff --git a/erpnext/setup/setup_wizard/setup_wizard.py b/erpnext/setup/setup_wizard/setup_wizard.py index eced8d0a0e..456ef926f7 100644 --- a/erpnext/setup/setup_wizard/setup_wizard.py +++ b/erpnext/setup/setup_wizard/setup_wizard.py @@ -9,13 +9,7 @@ from time import time from frappe import _ from .operations import install_fixtures as fixtures, taxes_setup, company_setup, sample_data - -from frappe import _, _dict from frappe.utils import cstr, getdate -from argparse import Namespace -from frappe.desk.page.setup_wizard.setup_wizard import update_global_settings, run_post_setup_complete, make_records -from erpnext.accounts.doctype.account.chart_of_accounts.chart_of_accounts import get_charts_for_country -from journeys.journeys.config import get_journeys_config def get_setup_stages(args=None): if frappe.db.sql("select name from tabCompany"): @@ -124,46 +118,3 @@ def make_sample_data(domains): def login_as_first_user(args): if args.get("email") and hasattr(frappe.local, "login_manager"): frappe.local.login_manager.login_as(args.get("email")) - -@frappe.whitelist() -def install_fixtures(): - config = get_journeys_config().get('setup_config') or {} - - update_global_settings(_dict(config)) - - fixtures.install(_dict(config).country) - -@frappe.whitelist() -def install_company(args): - config = get_journeys_config().get('setup_config') or {} - args = json.loads(args) - args.update(config) - - fixtures.install_company(_dict(args)) - -@frappe.whitelist() -def setup_globals(args): - config = get_journeys_config().get('setup_config') or {} - args = json.loads(args) - args.update(config) - - fixtures.install_defaults(_dict(args)) - setup_taxes(args) - - run_post_setup_complete(args) - -@frappe.whitelist() -def setup(args, config=None): - install_fixtures() - install_company(args) - setup_globals(args) - - -@frappe.whitelist() -def get_country_and_charts(): - config = get_journeys_config().get('setup_config') or {} - country = config.get('country') - return { - 'country': country, - 'charts': get_charts_for_country(country) - }