Esempio n. 1
0
    def on_update(self):
        for df in self.meta.get("fields"):
            if df.fieldtype in ("Select", "Data", "Check"):
                frappe.db.set_default(df.fieldname, self.get(df.fieldname))

        if self.language:
            set_default_language(self.language)
Esempio n. 2
0
def update_global_settings(args):
	if args.language and args.language != "english":
		set_default_language(get_language_code(args.lang))
	frappe.clear_cache()

	update_system_settings(args)
	update_user_name(args)
Esempio n. 3
0
def update_global_settings(args):
    if args.language and args.language != "english":
        set_default_language(get_language_code(args.lang))
    frappe.clear_cache()

    update_system_settings(args)
    update_user_name(args)
Esempio n. 4
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"""
	args = process_args(args)

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

		frappe.clear_cache()

		# update system settings
		update_system_settings(args)

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

		# frappe.db.set_default('desktop:home_page', 'desktop')
		frappe.db.set_default('desktop:home_page', 'dashboard')
		frappe.db.commit()
		frappe.clear_cache()
	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. 5
0
    def on_update(self):
        for df in self.meta.get("fields"):
            if df.fieldtype not in no_value_fields:
                frappe.db.set_default(df.fieldname, self.get(df.fieldname))

        if self.language:
            set_default_language(self.language)
Esempio n. 6
0
    def on_update(self):
        for df in self.meta.get("fields"):
            if df.fieldtype not in no_value_fields:
                frappe.db.set_default(df.fieldname, self.get(df.fieldname))

        if self.language:
            set_default_language(self.language)
Esempio n. 7
0
	def on_update(self):
		for df in self.meta.get("fields"):
			if df.fieldtype in ("Select", "Data", "Check"):
				frappe.db.set_default(df.fieldname, self.get(df.fieldname))

		if self.language:
			set_default_language(self.language)
Esempio n. 8
0
def load_messages(language):
	frappe.clear_cache()
	set_default_language(language)
	m = get_dict("page", "setup-wizard")
	m.update(get_dict("boot"))
	send_translations(m)
	return frappe.local.lang
Esempio n. 9
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. 10
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. 11
0
def update_global_settings(args):
    if args.language and args.language != "English":
        set_default_language(get_language_code(args.language))
        frappe.db.commit()
    frappe.clear_cache()

    update_system_settings(args)
    if (frappe.conf.get('developer_mode') or 0) != 1 or frappe.flags.in_demo:
        update_user_name(args)
Esempio n. 12
0
	def on_update(self):
		for df in self.meta.get("fields"):
			if df.fieldtype not in no_value_fields:
				frappe.db.set_default(df.fieldname, self.get(df.fieldname))

		if self.language:
			set_default_language(self.language)

		frappe.cache().delete_value('system_settings')
		frappe.cache().delete_value('time_zone')
Esempio n. 13
0
def on_update(doc):
    for df in doc.meta.get("fields"):
        if df.fieldtype not in no_value_fields:
            frappe.db.set_default(df.fieldname, doc.get(df.fieldname))

    if doc.language:
        set_default_language(doc.language)

    frappe.cache().delete_value('system_settings')
    frappe.cache().delete_value('time_zone')
    frappe.local.system_settings = {}
Esempio n. 14
0
    def on_update(self):
        for df in self.meta.get("fields"):
            if df.fieldtype not in no_value_fields:
                frappe.db.set_default(df.fieldname, self.get(df.fieldname))

        if self.language:
            set_default_language(self.language)

        frappe.cache().delete_value('system_settings')
        frappe.cache().delete_value('time_zone')
        frappe.local.system_settings = {}

        if frappe.flags.update_last_reset_password_date:
            update_last_reset_password_date()
def load_messages(language):
	"""Load translation messages for given language from all `setup_wizard_requires`
	javascript files"""
	frappe.clear_cache()
	set_default_language(get_language_code(language))
	m = get_dict("page", "setup-wizard")

	for path in frappe.get_hooks("setup_wizard_requires"):
		# common folder `assets` served from `sites/`
		js_file_path = os.path.abspath(frappe.get_site_path("..", *path.strip("/").split("/")))
		m.update(get_dict("jsfile", js_file_path))

	m.update(get_dict("boot"))
	send_translations(m)
	return frappe.local.lang
Esempio n. 16
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()
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. 18
0
def setup_complete(args=None):
	if frappe.db.sql("select name from tabCompany"):
		frappe.throw(_("Setup Already Complete!!"))

	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)
	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. 19
0
def setup_complete(args=None):
	if frappe.db.sql("select name from tabCompany"):
		frappe.throw(_("Setup Already Complete!!"))

	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)
	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. 20
0
    def on_update(self):
        for df in self.meta.get("fields"):
            if df.fieldtype not in no_value_fields and self.has_value_changed(
                    df.fieldname):
                frappe.db.set_default(df.fieldname, self.get(df.fieldname))

        if self.language:
            set_default_language(self.language)

        frappe.cache().delete_value('system_settings')
        frappe.cache().delete_value('time_zone')
        frappe.local.system_settings = {}

        if frappe.flags.update_last_reset_password_date:
            update_last_reset_password_date()

        if self.use_original_name_for_amended_document and \
          self.has_value_changed('use_original_name_for_amended_document'):
            rename_fun = 'frappe.model.utils.rename_cancelled_docs.rename_cancelled_docs'
            frappe.enqueue(rename_fun)
            frappe.msgprint(
                _("preparing the system to use original names for amended docs."
                  "System might be a little slow for a few seconds as it gets ready."
                  ))
Esempio n. 21
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)