Example #1
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,
		'date_format': frappe.db.get_value("Country", args.get("country"), "date_format"),
		'number_format': number_format,
		'enable_scheduler': 1
	})
	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.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()
Example #2
0
def execute():
    country = get_country_info(country="Turkey")
    add_country_and_currency("Turkey", country)
Example #3
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'),
		"country": args.get("country"),
	})

	global_defaults.save()

	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': get_country_info(args.get("country")).get("number_format", "#,###.##"),
	})

	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.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()

	email_settings = frappe.get_doc("Outgoing Email Settings")
	email_settings.send_print_in_body_and_attachment = 1
	email_settings.save()
Example #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,
        'date_format':
        frappe.db.get_value("Country", args.get("country"), "date_format"),
        'number_format':
        number_format,
        'enable_scheduler':
        1
    })
    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.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()
Example #5
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'),
        "country": args.get("country"),
    })

    global_defaults.save()

    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':
        get_country_info(args.get("country")).get("number_format", "#,###.##"),
    })

    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.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()

    email_settings = frappe.get_doc("Outgoing Email Settings")
    email_settings.send_print_in_body_and_attachment = 1
    email_settings.save()
def execute():
	country = get_country_info(country="Turkey")
	add_country_and_currency("Turkey", country)