Deleted most of the code, and added fixtures for everything

This commit is contained in:
Ali 2025-03-04 21:21:37 +04:00
parent 27e9476a0f
commit 64601c4210
5 changed files with 29 additions and 27 deletions

View File

@ -0,0 +1,16 @@
[
{
"doctype": "Country",
"name": "Azerbaijan",
"code": "AZ",
"currency": "AZN",
"currency_name": "Azerbaijani Manat",
"currency_symbol": "₼",
"currency_fraction": "Qəpik",
"currency_fraction_units": 100,
"smallest_currency_fraction_value": 0.01,
"number_format": "#,###.##",
"timezones": ["Asia/Baku"],
"isd": "+994"
}
]

View File

@ -0,0 +1,8 @@
[
{
"doctype": "Language",
"language_code": "az",
"language_name": "Azərbaycan",
"enabled": 1
}
]

View File

@ -1,22 +0,0 @@
import json
import os
from frappe.utils import get_bench_path
def update_country_info():
file_path = os.path.join(get_bench_path(), "apps", "frappe", "frappe", "geo", "country_info.json")
# Читаем JSON
with open(file_path, "r", encoding="utf-8") as f:
data = json.load(f)
# Проверяем, есть ли "Azerbaijan" в данных
if "Azerbaijan" in data:
data["Azerbaijan"]["currency"] = "AZN" # Добавляем валюту
data["Azerbaijan"]["currency_fraction"] = "Qəpik" # Исправляем значение
data["Azerbaijan"]["currency_symbol"] = "" # Добавляем символ маната
data["Azerbaijan"]["currency_name"] = "Azerbaijani Manat" # Добавляем название валюты
data["Azerbaijan"]["currency_fraction_units"] = 100 # Добавляем дробные единицы (копейки)
# Записываем обратно в JSON
with open(file_path, "w", encoding="utf-8") as f:
json.dump(data, f, indent=4, ensure_ascii=False)

View File

@ -7,7 +7,11 @@ app_license = "unlicense"
after_install = "az_locale.install.after_install" after_install = "az_locale.install.after_install"
# fixtures = ["fixtures/currency.json"] fixtures = [
"fixtures/currency.json",
"fixtures/languages.json",
"fixtures/countries.json"
]
# Apps # Apps
# ------------------ # ------------------

View File

@ -1,8 +1,4 @@
from az_locale.geo.update_country_info import update_country_info
from az_locale.locale.setup_locale import setup_locale from az_locale.locale.setup_locale import setup_locale
from az_locale.locale.update_languages import update_languages
def after_install(): def after_install():
update_country_info() # Обновляем страны
setup_locale() # Добавляем файлы локализации setup_locale() # Добавляем файлы локализации
update_languages() # Добавляем азербайджанский язык