fix: deduplicate currencies manually

on mariadb 10.3 `insert ignore` doesn't work
This commit is contained in:
Ankush Menat 2022-12-05 16:00:44 +05:30
parent 90a4c93bf9
commit 56b6e3eabd

View file

@ -29,6 +29,8 @@ def get_countries_and_currencies():
countries = []
currencies = []
added_currencies = set()
for name, country in data.items():
country = frappe._dict(country)
countries.append(
@ -42,7 +44,9 @@ def get_countries_and_currencies():
time_zones="\n".join(country.timezones or []),
)
)
if country.currency:
if country.currency and country.currency not in added_currencies:
added_currencies.add(country.currency)
currencies.append(
frappe.get_doc(
doctype="Currency",