From 8c4af6c7d3ba20fbcf96a311a4eab88e4e551759 Mon Sep 17 00:00:00 2001 From: Ali <010109ali@gmail.com> Date: Tue, 4 Mar 2025 19:58:20 +0400 Subject: [PATCH] Added currency azn to hooks --- az_locale/install.py | 4 +++- az_locale/setup/setup_currency.py | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 az_locale/setup/setup_currency.py diff --git a/az_locale/install.py b/az_locale/install.py index 92650db..3421903 100644 --- a/az_locale/install.py +++ b/az_locale/install.py @@ -1,8 +1,10 @@ from az_locale.geo.update_country_info import update_country_info from az_locale.locale.setup_locale import setup_locale -from az_locale.locale.update_languages import update_languages # Добавили новый импорт +from az_locale.locale.update_languages import update_languages +from az_locale.setup.setup_currency import setup_currency def after_install(): update_country_info() # Обновляем страны setup_locale() # Добавляем файлы локализации update_languages() # Добавляем азербайджанский язык + setup_currency() # Добавляем валюту AZN diff --git a/az_locale/setup/setup_currency.py b/az_locale/setup/setup_currency.py new file mode 100644 index 0000000..c9a73df --- /dev/null +++ b/az_locale/setup/setup_currency.py @@ -0,0 +1,20 @@ +import frappe + +def setup_currency(): + if not frappe.db.exists("Currency", "AZN"): + currency = frappe.get_doc({ + "doctype": "Currency", + "currency_name": "Azerbaijani Manat", + "symbol": "₼", + "fraction": "Qəpik", + "fraction_units": 100, + "smallest_currency_fraction_value": 0.01, + "number_format": "#,###.##", + "enabled": 1, + "name": "AZN" + }) + currency.insert(ignore_permissions=True) + frappe.db.commit() + print("✅ Валюта AZN успешно добавлена!") + else: + print("⚠️ Валюта AZN уже существует!")