diff --git a/jey_wizard/__init__.py b/jey_wizard/__init__.py index fb69db9..f3b4574 100644 --- a/jey_wizard/__init__.py +++ b/jey_wizard/__init__.py @@ -1 +1 @@ -__version__ = "0.1.14" +__version__ = "0.1.15" diff --git a/jey_wizard/etaxes.py b/jey_wizard/etaxes.py index 5de7f14..ec6da82 100644 --- a/jey_wizard/etaxes.py +++ b/jey_wizard/etaxes.py @@ -200,16 +200,23 @@ def fetch_company_profile(): cache.save() frappe.db.commit() + # Lower-case the raw criteria once so the JS layer can do a simple + # equality check (criteriaOfBusinessEntity arrives capitalised in some + # tenants — "Micro" vs "micro"). + criteria_raw = profile.get("criteriaOfBusinessEntity") if isinstance(profile, dict) else None + criteria = str(criteria_raw).strip().lower() if criteria_raw else "" + frappe.log_error( json.dumps({ "has_profile": bool(profile), "profile_keys": sorted(list(profile.keys())) if isinstance(profile, dict) else None, "resolved": resolved, + "criteria": criteria, }, ensure_ascii=False, indent=2), "Jey Wizard trace: fetch_company_profile done", ) - return {"ok": True, "resolved": resolved} + return {"ok": True, "resolved": resolved, "criteria": criteria} @frappe.whitelist() diff --git a/jey_wizard/public/js/jey_setup.js b/jey_wizard/public/js/jey_setup.js index 7dac559..fc3db77 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.14"; +const JEY_WIZARD_VERSION = "0.1.15"; // 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. @@ -54,6 +54,13 @@ frappe.setup.SetupWizard = class JeySetupWizard { fy_end_date: `${year}-12-31`, valuation_method: "FIFO", accounting_method: "Hesablama metodu", + // Auto-pick Kassa for micro entities. Reset to true only when + // fetch_company_profile returns a known criteria — without that + // signal we keep the static default. Toggled to true the moment + // the user touches the select so the criteria heuristic stops + // overwriting their choice. + accounting_method_user_edited: false, + business_criteria: "", // Admin user (fresh user step — Administrator stays untouched) user_full_name: "", user_email: "", @@ -432,7 +439,7 @@ frappe.setup.SetupWizard = class JeySetupWizard { -