fix: deduplicate currencies manually
on mariadb 10.3 `insert ignore` doesn't work
This commit is contained in:
parent
90a4c93bf9
commit
56b6e3eabd
1 changed files with 5 additions and 1 deletions
|
|
@ -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",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue