From e166da49cc1ab40de00a3d44993ab4b1b70a2155 Mon Sep 17 00:00:00 2001
From: Ali <010109ali@gmail.com>
Date: Fri, 24 Apr 2026 11:38:19 +0000
Subject: [PATCH] =?UTF-8?q?Auto-import=20all=20fetched=20=C6=8FMAS=20emplo?=
=?UTF-8?q?yees;=20apply=20default=20language=20on=20boot?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- Remove the manual employee selection UI. After loading, the wizard caches
every record returned by emasValidEmploymentContractOnline and lands on
the done sub-state. import_bulk_employees updates existing records on
FIN match, so running on a populated site is safe.
- On constructor, if the booted session lang differs from the wizard's
default (az), trigger load_messages so the UI renders in that language
without the user having to re-pick it from the dropdown.
---
jey_wizard/__init__.py | 2 +-
jey_wizard/public/js/jey_setup.js | 138 ++++++++++--------------------
2 files changed, 47 insertions(+), 93 deletions(-)
diff --git a/jey_wizard/__init__.py b/jey_wizard/__init__.py
index 6526deb..a73339b 100644
--- a/jey_wizard/__init__.py
+++ b/jey_wizard/__init__.py
@@ -1 +1 @@
-__version__ = "0.0.7"
+__version__ = "0.0.8"
diff --git a/jey_wizard/public/js/jey_setup.js b/jey_wizard/public/js/jey_setup.js
index b22cbee..dcc64e2 100644
--- a/jey_wizard/public/js/jey_setup.js
+++ b/jey_wizard/public/js/jey_setup.js
@@ -10,7 +10,7 @@ frappe.provide("jey_wizard");
// Bump this string in every commit that changes wizard code. Displayed in the badge so
// we can tell at a glance which version is actually running on a given machine. Kept in
// sync with __version__ in jey_wizard/__init__.py.
-const JEY_WIZARD_VERSION = "0.0.7";
+const JEY_WIZARD_VERSION = "0.0.8";
// Wipe Frappe + ERPNext default slides so their `before_load`/`after_load` listeners
// don't try to mutate a wizard that isn't slide-based anymore.
@@ -72,6 +72,15 @@ frappe.setup.SetupWizard = class JeySetupWizard {
this.current_step = 0;
this.steps = ["language", "asan", "employees", "company", "confirm"];
this.render();
+
+ // Session arrives in whatever language Frappe booted in (usually English for
+ // the first-run Administrator). Pull the default language's translations
+ // immediately so every subsequent render runs in that language without the
+ // user having to re-pick it.
+ const bootLang = (frappe.boot.lang || "en").split("-")[0];
+ if (bootLang !== this.data.language) {
+ this.change_language(this.data.language, /* force */ true);
+ }
}
// Frappe's on_page_show calls frappe.wizard.show_slide — no-op for us.
@@ -334,71 +343,20 @@ frappe.setup.SetupWizard = class JeySetupWizard {