feat: rename default Item/Supplier Groups to Azerbaijani

Add rename_default_groups.py that uses frappe.rename_doc to rename
standard ERPNext groups (Products -> Məhsullar, etc.) instead of
modifying ERPNext source files directly. Runs on after_migrate.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ali 2026-04-06 15:30:00 +04:00
parent 09af27e22b
commit 5ea710d77c
2 changed files with 43 additions and 0 deletions

View File

@ -0,0 +1,41 @@
import frappe
ITEM_GROUP_RENAMES = {
"Products": "Məhsullar",
"Raw Material": "Xammal",
"Services": "Xidmətlər",
"Sub Assemblies": "Alt məclislər",
"Consumable": "İstehlak materialı",
}
SUPPLIER_GROUP_RENAMES = {
"Local": "Yerli",
"Electrical": "Elektrik",
"Hardware": "Avadanlıq",
"Pharmaceutical": "Əczaçılıq",
"Distributor": "Distribyutor",
}
def rename_default_groups():
for old_name, new_name in ITEM_GROUP_RENAMES.items():
_rename_doc("Item Group", old_name, new_name)
for old_name, new_name in SUPPLIER_GROUP_RENAMES.items():
_rename_doc("Supplier Group", old_name, new_name)
def _rename_doc(doctype, old_name, new_name):
if frappe.db.exists(doctype, new_name):
return
if not frappe.db.exists(doctype, old_name):
return
try:
frappe.rename_doc(doctype, old_name, new_name, force=True)
frappe.db.commit()
print(f"[jey_erp] Renamed {doctype}: {old_name} -> {new_name}")
except Exception as e:
print(f"[jey_erp] Error renaming {doctype} '{old_name}': {e}")

View File

@ -100,6 +100,8 @@ def after_migrate_combined():
show_item_tax_template_in_sales_invoice()
from jey_erp.custom.vat_calculations import patch_sales_documents
patch_sales_documents()
from jey_erp.custom.rename_default_groups import rename_default_groups
rename_default_groups()
# REMOVED: Asset categories creation moved to setup_wizard_complete hook
# from jey_erp.custom.create_asset_categories import create_asset_categories
# create_asset_categories()