Esempio n. 1
0
def setup_complete(args=None):
    if frappe.db.sql("select name from tabCompany"):
        frappe.throw(_("Setup Already Complete!!"))

    install_fixtures.install(args.get("country"))

    update_user_name(args)
    create_fiscal_year_and_company(args)
    create_users(args)
    set_defaults(args)
    create_territories()
    create_price_lists(args)
    create_feed_and_todo()
    create_email_digest()
    create_letter_head(args)
    create_taxes(args)
    create_items(args)
    create_customers(args)
    create_suppliers(args)
    frappe.local.message_log = []

    website_maker(args.company_name.strip(), args.company_tagline, args.name)
    create_logo(args)

    frappe.db.commit()
    login_as_first_user(args)
    frappe.db.commit()
    frappe.clear_cache()

    if args.get("add_sample_data"):
        try:
            make_sample_data()
            frappe.clear_cache()
        except FiscalYearError:
            pass
Esempio n. 2
0
def setup_complete(args=None):
	if frappe.db.sql("select name from tabCompany"):
		frappe.throw(_("Setup Already Complete!!"))

	install_fixtures.install(args.get("country"))

	update_user_name(args)
	create_fiscal_year_and_company(args)
	create_users(args)
	set_defaults(args)
	create_territories()
	create_price_lists(args)
	create_feed_and_todo()
	create_email_digest()
	create_letter_head(args)
	create_taxes(args)
	create_items(args)
	create_customers(args)
	create_suppliers(args)
	frappe.local.message_log = []

	website_maker(args.company_name.strip(), args.company_tagline, args.name)
	create_logo(args)

	frappe.db.commit()
	login_as_first_user(args)
	frappe.db.commit()
	frappe.clear_cache()

	if args.get("add_sample_data"):
		try:
			make_sample_data()
			frappe.clear_cache()
		except FiscalYearError:
			pass
Esempio n. 3
0
def setup_account(args=None):

	if frappe.db.sql("select name from tabCompany"):
		frappe.throw(_("Setup Already Complete!!"))

	if not args:
		args = frappe.local.form_dict
	if isinstance(args, basestring):
		args = json.loads(args)
	args = frappe._dict(args)

	if args.language != "english":
		set_default_language(args.language)

	install_fixtures.install(args.get("country"))

	update_user_name(args)
	frappe.local.message_log = []

	create_fiscal_year_and_company(args)
	frappe.local.message_log = []

	set_defaults(args)
	frappe.local.message_log = []

	create_territories()
	frappe.local.message_log = []

	create_price_lists(args)
	frappe.local.message_log = []

	create_feed_and_todo()
	frappe.local.message_log = []

	create_email_digest()
	frappe.local.message_log = []

	create_letter_head(args)
	frappe.local.message_log = []

	create_taxes(args)
	frappe.local.message_log = []

	create_items(args)
	frappe.local.message_log = []

	create_customers(args)
	frappe.local.message_log = []

	create_suppliers(args)
	frappe.local.message_log = []

	frappe.db.set_default('desktop:home_page', 'desktop')

	website_maker(args.company_name, args.company_tagline, args.name)
	create_logo(args)

	frappe.clear_cache()
	frappe.db.commit()
Esempio n. 4
0
def setup_account(args=None):

    if frappe.db.sql("select name from tabCompany"):
        frappe.throw(_("Setup Already Complete!!"))

    if not args:
        args = frappe.local.form_dict
    if isinstance(args, basestring):
        args = json.loads(args)
    args = frappe._dict(args)

    if args.language != "english":
        set_default_language(args.language)

    install_fixtures.install(args.get("country"))

    update_user_name(args)
    frappe.local.message_log = []

    create_fiscal_year_and_company(args)
    frappe.local.message_log = []

    set_defaults(args)
    frappe.local.message_log = []

    create_territories()
    frappe.local.message_log = []

    create_price_lists(args)
    frappe.local.message_log = []

    create_feed_and_todo()
    frappe.local.message_log = []

    create_email_digest()
    frappe.local.message_log = []

    create_letter_head(args)
    frappe.local.message_log = []

    create_taxes(args)
    frappe.local.message_log = []

    create_items(args)
    frappe.local.message_log = []

    create_customers(args)
    frappe.local.message_log = []

    create_suppliers(args)
    frappe.local.message_log = []

    frappe.db.set_default('desktop:home_page', 'desktop')

    website_maker(args.company_name, args.company_tagline, args.name)
    create_logo(args)

    frappe.clear_cache()
    frappe.db.commit()
Esempio n. 5
0
def setup_complete(args=None):
	if frappe.db.sql("select name from tabCompany"):
		frappe.throw(_("Setup Already Complete!!"))

	install_fixtures.install(args.get("country"))

	create_price_lists(args)
	create_fiscal_year_and_company(args)
	create_sales_tax(args)
	create_users(args)
	set_defaults(args)
	create_territories()
	create_feed_and_todo()
	create_email_digest()
	create_letter_head(args)
	create_taxes(args)
	create_items(args)
	create_customers(args)
	create_suppliers(args)

	if args.domain.lower() == 'education':
		create_academic_year()
		create_academic_term()
		create_program(args)
		create_course(args)
		create_instructor(args)
		create_room(args)

	if args.get('setup_website'):
		website_maker(args)

	create_logo(args)

	frappe.local.message_log = []
	setup_domain(args.get('domain'))

	frappe.db.commit()
	login_as_first_user(args)

	frappe.db.commit()
	frappe.clear_cache()

	if args.get("add_sample_data"):
		try:
			make_sample_data(args)
			frappe.clear_cache()
		except:
			# clear message
			if frappe.message_log:
				frappe.message_log.pop()

			pass
Esempio n. 6
0
def setup_complete(args=None):
    if frappe.db.sql("select name from tabCompany"):
        frappe.throw(_("Setup Already Complete!!"))

    install_fixtures.install(args.get("country"))

    create_price_lists(args)
    create_fiscal_year_and_company(args)
    create_sales_tax(args)
    create_users(args)
    set_defaults(args)
    create_territories()
    create_feed_and_todo()
    create_email_digest()
    create_letter_head(args)
    create_taxes(args)
    create_items(args)
    create_customers(args)
    create_suppliers(args)

    if args.get('domain').lower() == 'education':
        create_academic_year()
        create_academic_term()
        create_program(args)
        create_course(args)
        create_instructor(args)
        create_room(args)

    if args.get('setup_website'):
        website_maker(args)

    create_logo(args)

    frappe.local.message_log = []
    setup_domain(args.get('domain'))

    frappe.db.commit()
    login_as_first_user(args)

    frappe.db.commit()
    frappe.clear_cache()

    if args.get("add_sample_data"):
        try:
            make_sample_data(args)
            frappe.clear_cache()
        except:
            # clear message
            if frappe.message_log:
                frappe.message_log.pop()

            pass
Esempio n. 7
0
def setup_complete(args=None):
    if frappe.db.sql("select name from tabCompany"):
        frappe.throw(_("Setup Already Complete!!"))

    install_fixtures.install(args.get("country"))

    create_price_lists(args)
    create_fiscal_year_and_company(args)
    create_sales_tax(args)
    create_employee_for_self(args)
    set_defaults(args)
    create_territories()
    create_feed_and_todo()
    create_email_digest()
    create_letter_head(args)
    set_no_copy_fields_in_variant_settings()

    if args.get('domain').lower() == 'education':
        create_academic_year()
        create_academic_term()

    if args.domain.lower() == 'healthcare':
        setup_healthcare()

    if args.get('setup_website'):
        website_maker(args)

    create_logo(args)

    frappe.local.message_log = []
    setup_domain(args.get('domain'))

    frappe.db.commit()
    login_as_first_user(args)

    frappe.db.commit()
    frappe.clear_cache()

    try:
        make_sample_data(args.get('domain'))
        frappe.clear_cache()
    except:
        # clear message
        if frappe.message_log:
            frappe.message_log.pop()

        pass
Esempio n. 8
0
def setup_complete(args):
    """Calls hooks for `setup_wizard_complete`, sets home page as `desktop`
	and clears cache. If wizard breaks, calls `setup_wizard_exception` hook"""

    if cint(frappe.db.get_single_value('System Settings', 'setup_complete')):
        # do not throw an exception if setup is already complete
        # let the user continue to desk
        return
        #frappe.throw(_('Setup already complete'))

    args = process_args(args)

    try:
        if args.language and args.language != "english":
            set_default_language(get_language_code(args.lang))

        frappe.clear_cache()

        # update system settings
        update_system_settings(args)
        update_user_name(args)

        for method in frappe.get_hooks("setup_wizard_complete"):
            frappe.get_attr(method)(args)

        disable_future_access()

        frappe.db.commit()
        frappe.clear_cache()
    except:
        frappe.db.rollback()
        if args:
            traceback = frappe.get_traceback()
            for hook in frappe.get_hooks("setup_wizard_exception"):
                frappe.get_attr(hook)(traceback, args)

        raise

    else:
        for hook in frappe.get_hooks("setup_wizard_success"):
            frappe.get_attr(hook)(args)
        install_fixtures.install()
Esempio n. 9
0
def setup_account(args=None):
	try:
		if frappe.db.sql("select name from tabCompany"):
			frappe.throw(_("Setup Already Complete!!"))

		if not args:
			args = frappe.local.form_dict
		if isinstance(args, basestring):
			args = json.loads(args)

		args = frappe._dict(args)

		if args.language and args.language != "english":
			set_default_language(args.language)

		frappe.clear_cache()

		install_fixtures.install(args.get("country"))

		update_user_name(args)
		frappe.local.message_log = []

		create_fiscal_year_and_company(args)
		frappe.local.message_log = []

		create_users(args)
		frappe.local.message_log = []

		set_defaults(args)
		frappe.local.message_log = []

		create_territories()
		frappe.local.message_log = []

		create_price_lists(args)
		frappe.local.message_log = []

		create_feed_and_todo()
		frappe.local.message_log = []

		create_email_digest()
		frappe.local.message_log = []

		create_letter_head(args)
		frappe.local.message_log = []

		create_taxes(args)
		frappe.local.message_log = []

		create_items(args)
		frappe.local.message_log = []

		create_customers(args)
		frappe.local.message_log = []

		create_suppliers(args)
		frappe.local.message_log = []

		frappe.db.set_default('desktop:home_page', 'desktop')

		website_maker(args.company_name.strip(), args.company_tagline, args.name)
		create_logo(args)

		frappe.db.commit()

		login_as_first_user(args)

		frappe.db.commit()

		frappe.clear_cache()

		if args.get("add_sample_data"):
			try:
				make_sample_data()
				frappe.clear_cache()
			except FiscalYearError:
				pass

	except:
		if args:
			traceback = frappe.get_traceback()
			for hook in frappe.get_hooks("setup_wizard_exception"):
				frappe.get_attr(hook)(traceback, args)

		raise

	else:
		for hook in frappe.get_hooks("setup_wizard_success"):
			frappe.get_attr(hook)(args)
Esempio n. 10
0
def setup_complete(args=None):

    if frappe.db.sql("select name from tabCompany"):
        frappe.throw(_("Setup Already Complete!!"))

    install_fixtures.install(args.get("country"))

    create_price_lists(args)
    create_fiscal_year_and_company(args)
    create_sales_tax(args)
    create_users(args)
    set_defaults(args)
    create_professional_contact_card(args)
    create_territories()
    create_feed_and_todo()
    create_email_digest()
    create_letter_head(args)
    create_taxes(args)
    create_items(args)
    create_customers(args)
    create_suppliers(args)
    create_midwife_tax_template(args)

    install_fixtures.codifications(args.get("country"))

    #website_maker(args)

    create_logo(args)

    frappe.local.message_log = []
    setup_domain(args.get('domain'))

    frappe.db.commit()
    login_as_first_user(args)

    frappe.db.commit()
    frappe.clear_cache()

    set_mode_of_payment_account(args)
    frappe.db.commit()

    correct_midwife_accounts(args)

    initial_list = [
        'Stock', 'Manufacturing', 'Learn', 'Buying', 'Selling', 'Support',
        'Integrations', 'Maintenance', 'Schools', 'HR', 'CRM', 'Employee',
        'Issue', 'Lead', 'POS', 'Student', 'Student Group', 'Course Schedule',
        'Student Attendance', 'Course', 'Program', 'Student Applicant', 'Fees',
        'Instructor', 'Room'
    ]
    hidden_list = []

    for i in initial_list:
        try:
            frappe.get_doc('Desktop Icon', {'standard': 1, 'module_name': i})
            hidden_list.append(i)
        except Exception:
            pass

    set_hidden_list(hidden_list)

    if args.get("add_sample_data"):
        try:
            make_sample_data(args)
            frappe.clear_cache()
        except:
            # clear message
            if frappe.message_log:
                frappe.message_log.pop()

            pass