From 40f65ffd90701726caa143b23d13590970e66753 Mon Sep 17 00:00:00 2001 From: Ali <010109ali@gmail.com> Date: Wed, 29 Apr 2026 16:28:55 +0000 Subject: [PATCH] Frappe Date controls, finalize progress bar, full message_log clear MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Three UX fixes for the post-setup experience: 1. Native Frappe Date pickers on the company step Replaces for fy_start/fy_end with frappe.ui.form.make_control({fieldtype:"Date"}). Same Flatpickr- styled control the rest of the desk uses. Values come back as YYYY-MM-DD via get_value(), matching the previous .val() contract. 2. Inline progress bar instead of the freeze overlay finalize() now renders a status line + animated bar in place of the wizard form, and drops freeze:true so the bar is visible. Subscribes to the realtime "setup_task" channel that process_setup_stages publishes — translates the [done, total] tuples into a 5%→95% bar fill, finishes at 100% on success, and handles the realtime "fail" case by switching to the error view. 3. Wipe all setup-time messages, not just alerts _drop_alert_messages → frappe.clear_messages(). The old filter missed non-alert msgprints, so HRMS Salary Component "Hesablar təyin edilməyib" warnings and Frappe's "Employee Self Service rolu silindi" note for the new admin user still surfaced as a modal. Genuine failures raise; everything queued for the response by this point is just noise for an automated run. --- jey_wizard/__init__.py | 2 +- jey_wizard/etaxes.py | 24 ++++----- jey_wizard/public/js/jey_setup.js | 90 +++++++++++++++++++++++++------ 3 files changed, 87 insertions(+), 29 deletions(-) diff --git a/jey_wizard/__init__.py b/jey_wizard/__init__.py index f3b4574..970659c 100644 --- a/jey_wizard/__init__.py +++ b/jey_wizard/__init__.py @@ -1 +1 @@ -__version__ = "0.1.15" +__version__ = "0.1.16" diff --git a/jey_wizard/etaxes.py b/jey_wizard/etaxes.py index ec6da82..a5a73f6 100644 --- a/jey_wizard/etaxes.py +++ b/jey_wizard/etaxes.py @@ -1103,24 +1103,22 @@ def _find_default_warehouse(company): def _drop_alert_messages(): - """Remove every entry from frappe.local.message_log that was queued via - frappe.msgprint(alert=True) (a.k.a. toast). Keeps non-alert msgprints so - the user still sees real warnings. + """Wipe everything in frappe.local.message_log that piled up during the + setup_complete request. We need the entire log gone, not just alerts: + besides the az_locale rename toasts (alert=True), HRMS Salary Component + warnings ("Hesablar təyin edilməyib") and Frappe's own user-creation + notes ("Employee Self Service rolu silindi") come through plain + msgprints — and they're noise for an automated setup. Genuine failures + would have raised an exception and been handled separately, so blanket + clearing is safe here. """ try: - log = list(getattr(frappe.local, "message_log", []) or []) + frappe.clear_messages() except Exception: - return - if not log: - return - def _is_alert(m): try: - if isinstance(m, dict): - return bool(m.get("alert")) - return bool(getattr(m, "alert", 0)) + frappe.local.message_log = [] except Exception: - return False - frappe.local.message_log = [m for m in log if not _is_alert(m)] + pass def _only_admin(): diff --git a/jey_wizard/public/js/jey_setup.js b/jey_wizard/public/js/jey_setup.js index fc3db77..627e7b3 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.1.15"; +const JEY_WIZARD_VERSION = "0.1.16"; // 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. @@ -415,11 +415,11 @@ frappe.setup.SetupWizard = class JeySetupWizard {
${__("Setting up your system. This can take a minute...")}
` - ); + // Render an inline progress UI in place of the wizard form. We don't + // pass freeze:true to frappe.call — the freeze overlay would dim and + // hide the bar. process_setup_stages publishes realtime "setup_task" + // events with {progress: [idx, total], stage_status: "..."}; we + // subscribe and translate those into bar width + status text. + this.$wrap.find(".jey-body").html(` +${__("Setup complete! Redirecting...")}
` - ); + setProgress(100, __("Setup complete! Redirecting...")); + cleanup(); setTimeout(() => { window.location.href = "/app"; - }, 1500); + }, 800); } else if (m.status === "registered") { + cleanup(); this.show_error( __("Setup is running in background mode, not supported by skeleton"), JSON.stringify(m, null, 2) ); } else if (m.fail !== undefined) { + cleanup(); this.show_error(m.fail, JSON.stringify(m, null, 2)); } else { + cleanup(); this.show_error( __("Setup returned unexpected response"), JSON.stringify(m, null, 2) @@ -1358,6 +1417,7 @@ frappe.setup.SetupWizard = class JeySetupWizard { } }, error: () => { + cleanup(); const resp = frappe.last_response || {}; this.show_error( resp.setup_wizard_failure_message || __("Setup failed"),