Exemple #1
0
def import_country_and_currency():
    from frappe.country_info import get_all
    data = get_all()

    for name in data:
        country = frappe._dict(data[name])
        if not frappe.db.exists("Country", name):
            frappe.get_doc({
                "doctype": "Country",
                "country_name": name,
                "code": country.code,
                "date_format": country.date_format or "dd-mm-yyyy",
                "time_zones": "\n".join(country.timezones or [])
            }).insert()

        if country.currency and not frappe.db.exists("Currency",
                                                     country.currency):
            frappe.get_doc({
                "doctype": "Currency",
                "currency_name": country.currency,
                "fraction": country.currency_fraction,
                "symbol": country.currency_symbol,
                "fraction_units": country.currency_fraction_units,
                "number_format": country.number_format
            }).insert()

    # enable frequently used currencies
    for currency in ("INR", "USD", "GBP", "EUR", "AED", "AUD", "JPY", "CNY",
                     "CHF"):
        frappe.db.set_value("Currency", currency, "enabled", 1)
Exemple #2
0
def import_country_and_currency():
    from frappe.country_info import get_all
    data = get_all()

    for name in data:
        country = frappe._dict(data[name])
        if not frappe.db.exists("Country", name):
            frappe.get_doc({
                "doctype": "Country",
                "country_name": name,
                "code": country.code,
                "date_format": country.date_format or "dd-mm-yyyy",
                "time_zones": "\n".join(country.timezones or [])
            }).insert()

        if country.currency and not frappe.db.exists("Currency",
                                                     country.currency):
            frappe.get_doc({
                "doctype": "Currency",
                "currency_name": country.currency,
                "fraction": country.currency_fraction,
                "symbol": country.currency_symbol,
                "fraction_units": country.currency_fraction_units,
                "number_format": country.number_format
            }).insert()
Exemple #3
0
def import_country_and_currency():
    from frappe.country_info import get_all

    data = get_all()

    for name in data:
        country = frappe._dict(data[name])
        if not frappe.db.exists("Country", name):
            frappe.get_doc(
                {
                    "doctype": "Country",
                    "country_name": name,
                    "code": country.code,
                    "date_format": country.date_format or "dd-mm-yyyy",
                    "time_zones": "\n".join(country.timezones or []),
                }
            ).insert()

        if country.currency and not frappe.db.exists("Currency", country.currency):
            frappe.get_doc(
                {
                    "doctype": "Currency",
                    "currency_name": country.currency,
                    "fraction": country.currency_fraction,
                    "symbol": country.currency_symbol,
                    "fraction_units": country.currency_fraction_units,
                    "number_format": country.number_format,
                }
            ).insert()

            # enable frequently used currencies
    for currency in ("INR", "USD", "GBP", "EUR", "AED", "AUD", "JPY", "CNY", "CHF"):
        frappe.db.set_value("Currency", currency, "enabled", 1)
Exemple #4
0
def import_country_and_currency():
	from frappe.country_info import get_all
	data = get_all()

	for name in data:
		country = frappe._dict(data[name])
		add_country_and_currency(name, country)

	# enable frequently used currencies
	for currency in ("INR", "USD", "GBP", "EUR", "AED", "AUD", "JPY", "CNY", "CHF"):
		frappe.db.set_value("Currency", currency, "enabled", 1)
def import_country_and_currency():
    from frappe.country_info import get_all
    data = get_all()

    for name in data:
        country = frappe._dict(data[name])
        add_country_and_currency(name, country)

    # enable frequently used currencies
    for currency in ("INR", "USD", "GBP", "EUR", "AED", "AUD", "JPY", "CNY",
                     "CHF"):
        frappe.db.set_value("Currency", currency, "enabled", 1)
Exemple #6
0
def import_country_and_currency():
	from frappe.country_info import get_all
	data = get_all()

	for name in data:
		country = frappe._dict(data[name])
		if not frappe.db.exists("Country", name):
			frappe.get_doc({
				"doctype": "Country",
				"country_name": name,
				"code": country.code,
				"date_format": country.date_format or "dd-mm-yyyy",
				"time_zones": "\n".join(country.timezones or [])
			}).insert()

		if country.currency and not frappe.db.exists("Currency", country.currency):
			frappe.get_doc({
				"doctype": "Currency",
				"currency_name": country.currency,
				"fraction": country.currency_fraction,
				"symbol": country.currency_symbol,
				"fraction_units": country.currency_fraction_units,
				"number_format": country.number_format
			}).insert()
def execute():
    frappe.reload_doc("setup", "doctype", "country")
    import_country_and_currency()
    for name, country in get_all().iteritems():
        frappe.set_value("Country", name, "code", country.get("code"))
def execute():
	frappe.reload_doc("setup", "doctype", "country")
	import_country_and_currency()
	for name, country in get_all().iteritems():
		frappe.set_value("Country", name, "code", country.get("code"))