- Company step gains a "Stock Valuation" select (FIFO default, Moving
Average option). Value is passed through build_setup_args and applied
to Company.valuation_method in materialize_after_setup — Company-level
wins over Stock Settings in get_valuation_method, so inventory posts
use the choice immediately.
- Cannot be changed after first stock entry (helper text + ERPNext
validation), so this is the only window to set it cleanly.
- CLAUDE.md added to document the architecture for future sessions
(override trick, two separate auth flows, cache doctype, rollback
mechanics).
Country / Currency / Timezone / Chart of Accounts are fixed for every
AZ install and show no user-editable information — just noise on the
final review. Still passed to setup_complete unchanged; only the UI row
is gone.
During setup the Employee table is always empty, so the breakdown was
always "new: N, already in system: 0" — noise without signal. Removed
the counter and the get_list round-trip that fed it. The import step
still updates existing rows on FIN match if any ever appear.
- Remove the +994 badge from the phone input; it's applied silently on submit.
Placeholder simplified to "Enter number". Prefix select gets an explicit
border + white background so it stays visible under custom themes.
- Cert-pick confirm dialog shrinks to a single-line "Confirm selection: X?".
- "Wrong company? Change" now does a proper restart: the backend reset also
wipes bearer_token / certificates_json / verification_code and flips
auth_status back to "Not Authenticated", because e-taxes' bearer_token is
single-use per chooseTaxpayer. The JS immediately calls
handle_authentication to pull a fresh token — another SMS + phone tap
produces a new certs list without the 401 "Authentication required" that
was surfacing when re-using the consumed bearer_token.
- Phone input split: hardcoded +994, 8-option prefix dropdown (050/051/010/
055/060/070/077/099 shown, 2-digit values submitted), 7-digit local number
with numeric-only input filter. Full E.164 assembled on submit.
- Certificate selection now prompts a confirmation dialog before the cascade
(select_taxpayer → fetch_etaxes_data) fires. Asan/done sub-state gets a
"Wrong company? Change" button that wipes the Asan Login tokens and every
cache field (via new jey_wizard.api.reset_company_selection), then returns
the user to the certs list without another phone tap.
- Employees intro no longer shows a dedicated Skip button — Next in the nav
acts as skip (and clears any stale AMAS cache when used that way).
- Employees done no longer shows "Reload from ƏMAS" — Back in the nav is
the single way to rewind. The rogue button was sending users back into a
stale intro state with leftover buttons.
- 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.
- New employees step between asan and company: optional ƏMAS (MyGovID second
tap) load with auto-pick by VÖEN, fallback to organization list, selection
table with existing-Employee indicator, skippable.
- materialize_after_setup enqueues invoice_az.amas_api.import_bulk_employees
with the freshly-created Company so both Amas Employees and Employee
records get populated.
- Company step now has Start/End date pickers for Fiscal Year (default to
current calendar year, validated).
- All UI strings wrapped in __(); ru.csv and az.csv translation files added;
language change on step 1 reloads translations via load_messages.
- Back button works from every step and every sub-state (rewinds sub-state
first, then crosses step boundary without clobbering terminal states).
- Jey Wizard Etaxes Cache gains amas_selected_employees_json to carry the
user's selection across setup_complete; cleared on Skip.
Two-phase data loading so future wizard steps can consume tax-portal data before
Company exists, while still ending up with properly-linked E-Taxes DocType records.
Phase A (Asan step, after main_token):
- jey_wizard.etaxes.fetch_all_etaxes hits 6 endpoints (objects, cash registers,
POS terminals, bank accounts, obligation pacts, presented certs), using
invoice_az's Asan Login for the main_token. Paginated endpoints follow hasMore.
- Raw JSON per endpoint is stashed in the new single DocType
"Jey Wizard Etaxes Cache". Per-endpoint errors are logged but don't abort.
- jey_wizard.etaxes.get_cached(kind) is the read API for future wizard steps.
- UI: new "fetching" sub-state between cert pick and done. "done" now shows a
count summary of what was cached (or per-row error badge if a kind failed).
Phase B (setup_wizard_complete hook, after Company is created):
- jey_wizard.etaxes.materialize_after_setup receives setup args, reads
args.company_name, and calls invoice_az.company_api.load_company_* for each
of the six kinds. Those re-fetch and write into E-Taxes Object /
E-Taxes Cash Register / etc with the real Company link. Each loader is
best-effort; failures are logged, not raised.
Why re-fetch instead of materialising from the cache:
- invoice_az's loaders already own the ~500-line field mapping. Re-fetching
once with a still-fresh main_token beats duplicating that code.
Bump to 0.0.6.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
New wizard step between language and company:
1. User enters phone + Asan user_id, hits "Send SMS"
2. ensure_asan_login (jey_wizard.api) creates/resets the single Asan Login record
3. invoice_az.auth.handle_authentication kicks off SMS, JS shows verification code
4. Polling loop calls poll_auth_status every 5s up to 20 attempts (~100s total)
5. On confirmation, get_auth_certificates fetches certs; UI filters to legal-only
6. User picks one; select_certificate + select_taxpayer run back-to-back
7. get_company_from_cert (jey_wizard.api) parses selected_certificate_json and pulls
legalInfo.name + voen — no extra API call to the tax portal needed
8. Company step is then prefilled with that name (still editable)
Test scope: legal entities only, single Asan Login reused/reset on phone change,
no rollback machinery, no own renew_token scheduler (piggybacks on invoice_az's).
required_apps now includes invoice_az since we call its auth methods directly.
Bump to 0.0.5.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Move the version indicator to a dark badge in the top-right corner so it's obvious at
a glance which code is running. Previous muted footer was too easy to miss.
Bump to 0.0.4.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
erpnext's get_chart() iterates verified/*.json and matches on the JSON's `name` field,
not the filename. az_locale ships az_chart_of_accounts.json whose `name` is
"Azerbaijan Republic", so passing the filename made get_chart() return None and the
Company on_update hook crashed with "NoneType.get". make_records swallowed the
exception, Company never inserted, and downstream setup_wizard_complete hooks failed
loudly with "Company not found".
Bump to 0.0.3.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Bump jey_wizard version to 0.0.2 and display it at the bottom of every wizard screen.
Prevents the old-version-on-remote-machine confusion we just hit during testing.
Rule: bump both __version__ and the JEY_WIZARD_VERSION constant on every commit that
ships wizard code.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The Python finalize() shim imported frappe.desk.page.setup_wizard.setup_wizard.setup_complete
and called it as a plain function, which bypassed the HTTP/whitelist code path the default
wizard uses. This made the setup_company stage silently drop the Company insert via
make_records' blanket except, so downstream setup_wizard_complete hooks blew up with
"Company Test Company AZ not found".
Build all hardcoded AZ defaults on the client and call the stock endpoint over HTTP so we
go through typing_validations, sanitize_input and parse_args exactly like the default
wizard. api.py is left as a placeholder for future integrations.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>