From 56b6e3eabd2e822a2eb5f4209d67c4bf42f32fe4 Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Mon, 5 Dec 2022 16:00:44 +0530 Subject: [PATCH] fix: deduplicate currencies manually on mariadb 10.3 `insert ignore` doesn't work --- frappe/geo/doctype/country/country.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frappe/geo/doctype/country/country.py b/frappe/geo/doctype/country/country.py index 5738a1837d..8b1ec1364f 100644 --- a/frappe/geo/doctype/country/country.py +++ b/frappe/geo/doctype/country/country.py @@ -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",