Exemplo n.º 1
0
def update_system_settings(args):
    number_format = get_country_info(args.get("country")).get(
        "number_format", "#,###.##")

    # replace these as float number formats, as they have 0 precision
    # and are currency number formats and not for floats
    if number_format == "#.###":
        number_format = "#.###,##"
    elif number_format == "#,###":
        number_format = "#,###.##"

    system_settings = frappe.get_doc("System Settings", "System Settings")
    system_settings.update({
        "country":
        args.get("country"),
        "language":
        get_language_code(args.get("language")),
        "time_zone":
        args.get("timezone"),
        "float_precision":
        3,
        'date_format':
        frappe.db.get_value("Country", args.get("country"), "date_format"),
        'number_format':
        number_format,
        'enable_scheduler':
        1 if not frappe.flags.in_test else 0,
        'backup_limit':
        3  # Default for downloadable backups
    })
    system_settings.save()
Exemplo n.º 2
0
def setup_data_wizard(site,domain,company,country=None,langu=None,abbreviation=None):
    datafile='/home/frappe/frappe-bench/apps/erpnext/erpnext/hr/wdata/data.json'
    with open(datafile) as json_file:
        json_data = json.load(json_file)
        data = json_data if not None else []
        data['domain'] = domain
        data['company_name'] = company
        data['bank_account'] = company
        data['company_tagline'] = company
        if not abbreviation:
            abbreviation= ''.join([c[0] for c in company.split()]).upper()
        data['company_abbr'] = abbreviation.strip()
        data['country'] = country

        country_data= get_country_info(country)
        if  'currency' in country_data:
            currency= country_data.currency
            if currency:
                data['currency'] = currency
            else:
                data['currency'] = "ILS"

        if  'timezones' in country_data:
            timezones= country_data.timezones
            if timezones:
                data['timezone'] = timezones[0]
            else:
                data['timezone'] = "Asia/Jerusalem"

        with open(datafile, 'w') as outfile:
            json.dump(data, outfile, sort_keys=True,indent=4)

    return "done"
Exemplo n.º 3
0
def update_system_settings(args):
	number_format = get_country_info(args.get("country")).get("number_format", "#,###.##")

	# replace these as float number formats, as they have 0 precision
	# and are currency number formats and not for floats
	if number_format=="#.###":
		number_format = "#.###,##"
	elif number_format=="#,###":
		number_format = "#,###.##"

	system_settings = frappe.get_doc("System Settings", "System Settings")
	system_settings.update({
		"language": args.get("language"),
		"time_zone": args.get("timezone"),
		"float_precision": 3,
		'date_format': frappe.db.get_value("Country", args.get("country"), "date_format"),
		'number_format': number_format,
		'enable_scheduler': 1 if not frappe.flags.in_test else 0
	})
	system_settings.save()
Exemplo n.º 4
0
def set_defaults(args):
	# enable default currency
	frappe.db.set_value("Currency", args.get("currency"), "enabled", 1)

	global_defaults = frappe.get_doc("Global Defaults", "Global Defaults")
	global_defaults.update({
		'current_fiscal_year': args.curr_fiscal_year,
		'default_currency': args.get('currency'),
		'default_company':args.get('company_name').strip(),
		"country": args.get("country"),
	})

	global_defaults.save()

	number_format = get_country_info(args.get("country")).get("number_format", "#,###.##")

	# replace these as float number formats, as they have 0 precision
	# and are currency number formats and not for floats
	if number_format=="#.###":
		number_format = "#.###,##"
	elif number_format=="#,###":
		number_format = "#,###.##"

	system_settings = frappe.get_doc("System Settings", "System Settings")
	system_settings.update({
		"language": args.get("language"),
		"time_zone": args.get("timezone"),
		"float_precision": 3,
		"email_footer_address": args.get("company"),
		'date_format': frappe.db.get_value("Country", args.get("country"), "date_format"),
		'number_format': number_format,
		'enable_scheduler': 1 if not frappe.flags.in_test else 0
	})
	system_settings.save()

	accounts_settings = frappe.get_doc("Accounts Settings")
	accounts_settings.auto_accounting_for_stock = 1
	accounts_settings.save()

	stock_settings = frappe.get_doc("Stock Settings")
	stock_settings.item_naming_by = "Item Code"
	stock_settings.valuation_method = "FIFO"
	stock_settings.stock_uom = _("Nos")
	stock_settings.auto_indent = 1
	stock_settings.auto_insert_price_list_rate_if_missing = 1
	stock_settings.automatically_set_serial_nos_based_on_fifo = 1
	stock_settings.save()

	selling_settings = frappe.get_doc("Selling Settings")
	selling_settings.cust_master_name = "Customer Name"
	selling_settings.so_required = "No"
	selling_settings.dn_required = "No"
	selling_settings.save()

	buying_settings = frappe.get_doc("Buying Settings")
	buying_settings.supp_master_name = "Supplier Name"
	buying_settings.po_required = "No"
	buying_settings.pr_required = "No"
	buying_settings.maintain_same_rate = 1
	buying_settings.save()

	notification_control = frappe.get_doc("Notification Control")
	notification_control.quotation = 1
	notification_control.sales_invoice = 1
	notification_control.purchase_order = 1
	notification_control.save()

	hr_settings = frappe.get_doc("HR Settings")
	hr_settings.emp_created_by = "Naming Series"
	hr_settings.save()
def execute():
    country = get_country_info(country="Turkey")
    add_country_and_currency("Turkey", country)
def execute():
	country = get_country_info(country="Turkey")
	add_country_and_currency("Turkey", country)