Bank Integration Purpose used a generic BIP-#### id. Switched to the
Kapital Bank Purpose scheme: an autoname() controller method sets the
record name to the purpose_keyword text (truncated to 140, -N on
collision). A migration in after_migrate renames any existing BIP-####
records to their readable names (Link references update automatically).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
On save, a Bank Integration Customer/Supplier whose mapping row had its
erp_customer / erp_supplier cleared (not just whose row was deleted) is
now flipped back to status=New with mapped_customer/customer_group/
territory/payment_terms cleared — so a registry record never keeps a
phantom mapping.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The first-leaf fallback meant customers always landed in "Individual"
even when no Customer Group was chosen. Customer/Supplier/Territory
aren't actually mandatory in ERPNext, so now: a configured value is
validated (exists + leaf) and used; nothing configured -> the party is
created with an empty customer_group / supplier_group / territory.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Creating customers/suppliers no longer requires a default Customer/
Supplier Group or Territory on the Bank Integration — when none is set,
the first leaf (non-group) node of the tree is used. A configured value
is still validated (must exist and be a leaf), with a clear message.
Also: the default-group / default-territory Link fields (and the
matching mapping child-table fields) now filter to is_group=0 so a group
node can't be selected in the first place.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Customer/Supplier require a leaf node for customer_group/supplier_group/
territory; selecting a group node makes ERPNext throw "Cannot select a
Group type ...". The upfront validation now also checks is_group and
returns a clear message before any record is touched.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The Accounts / Customers / Suppliers / Purposes subtabs under "Data"
were stuck on "Loading..." — nothing rendered into them. Added
get_bi_reference_data_list (paginated rows for each registry, scoped to
the Bank Integration record) and the client-side rendering in
bank_integration.js (tables with status pills, links to the underlying
records and their ERPNext mappings, plus a Refresh button per subtab) —
mirroring the kapital_bank_settings Data tab.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Creating customers/suppliers/bank accounts from unmapped rows fell back
to "All Customer Groups" / "All Territories" / "All Supplier Groups",
which don't exist on localized sites — ERPNext then threw a cryptic
"Could not find Customer Group: All Customer Groups". Now creation
validates upfront and returns a clear message ("Set a Default Customer
Group on the Bank Integration ...") before touching any records. Same
for Territory, Supplier Group, and (for Bank Accounts) Company / Bank.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The Excel import dialog on the Bank Transaction list gains an "Also load
counterparties & purposes" checkbox (default on — preserves current
behaviour). When unchecked, only Bank Transactions are created and the
Bank Integration Customer/Supplier/Purpose registries are left alone.
The Bank Integration form gains a "Load Data" button: pick an Excel
preset + file and choose which registries to populate (Customers /
Suppliers / Purposes checkboxes, like the standard data import). It runs
the same upsert logic but creates no Bank Transactions — the file-based
counterpart to kapital_bank's API-driven counterparty/purpose loaders.
Backed by jey_erp.bank_integration.import_api.load_registries_from_excel.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The previous attempt double-set custom_purpose's hidden property
(visible in the forEach, then hidden in a follow-up if) and relied on
refresh_fields, which didn't re-render the hidden state. Now
_applyModeVisibility computes the final hidden value for each field in
one pass — folding the "Use original description" checkbox into the
custom_purpose decision — and calls refresh() on each field explicitly.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two BRT polish fixes:
- The checkbox column was added by destroying and rebuilding the
DataTable after each "Get Unreconciled Entries", which visibly redrew
the rows. Replaced with a wholesale override of DataTableManager's
get_datatable that creates the table with checkboxColumn:true from the
start and injects the toolbar there — no rebuild, no flicker. The
render-event polling is gone.
- _applyModeVisibility unconditionally un-hid "Custom Purpose Keyword"
when leaving "Documents & Reconcile" mode, overriding the effect of
the "Use original description" checkbox. Now it re-applies the
checkbox state after the mode-driven visibility pass.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The first jey_erp BRT implementation read row.name from dtm.transactions,
but those rows are arrays (per ERPNext's DataTableManager.format_row), so
the BT name was always undefined ("Could not resolve Bank Transaction
names"). Replaced it with a faithful port of kapital_bank's BRT
extension: the same checkbox column, "Create & Reconcile" toolbar, and
3-mode dialog (Both / Mappings Only / Documents & Reconcile), reading
the BT name from the row array the way kb did.
The dialog gains a "Mapping Source" select (defaulting from the Bank
Account's hidden bank_integration field, written back on submit). For a
Bank Integration source it calls the new
jey_erp.bank_integration.create_reconcile.create_purpose_mappings (a
port of kapital_bank/mapping.py adapted for the multi-record Bank
Integration doctype and Bank Integration Purpose); for a Kapital Bank
Settings source it calls kapital_bank.mapping.create_purpose_mappings
directly, leaving kb's proven backend untouched.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The checkbox column + Create & Reconcile toolbar setup was on the form's
`refresh` event, which fires only once. On a second "Get Unreconciled
Entries" ERPNext rebuilds the DataTableManager without the checkbox
column and the polling interval never restarted. Moved the enhancement
to the `render` event (fires on every rebuild), matching the pattern
the kapital_bank BRT extension used. The prototype patch that adds the
"Bank Transaction" column stays on `refresh` since it is idempotent.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Standard Field is now a Link to a new "Bank Integration Standard Field"
doctype (autoname=Prompt). Each entry holds a display name like "Date" /
"Reference Number" — the field that the user picks in Column Mappings —
and a `field_name` column with the technical key used by the parser.
Twelve standard fields ship as a fixture. The change replaces the old
Select with technical names (date, reference_number, debit, ...) which
were noisy in the UI.
Excel Preset gets two new fields:
- sample_file (Attach) — user uploads a sample of their bank's xlsx
- preview_html (HTML) — first 5 rows are rendered after detection
A "Detect Columns from Sample" custom button on the form calls a new
whitelisted endpoint detect_columns_from_sample() that reads the header
row + first 5 data rows. The Column Mappings table is repopulated with
one row per Excel header (Standard Field left empty for the user to
fill in), and the preview HTML shows what the parser actually sees so
the user can validate header_row / skip_rows. After detection the
sample File doc is removed via delete_sample_file().
excel_parser now resolves row.standard_field through Standard Field
to obtain the technical field_name. The Generic Bank Statement fixture
is updated to reference the new Link values.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds 10 doctypes (Bank Integration + 4 child mapping tables + 3
registries + Excel Preset + Excel Column Mapping), 7 backend modules
(parser, import API, matching, creation, mapping resolver, create &
reconcile, migrations), 3 JS files, and a Generic Excel preset fixture.
Two hidden Dynamic Link custom fields on Bank Account
(bank_integration_type / bank_integration) point to either the new
Bank Integration record or the existing Kapital Bank Settings, letting
the universal Create & Reconcile in BRT read mappings from either source
through one resolver. Both apps now share an "Import From..." dropdown
on Bank Transaction list.
Plan and rationale: BANK_INTEGRATION_PLAN.md.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replaces the free-text description in Landed Cost Taxes and Charges with a
service-item link, drives expense_account from a new Item.default_landed_cost_account,
adds an in-form "Get Items from Vendor Invoices" button, and validates totals
against vendor invoices on submit. Also fixes ERPNext's no-op items_remove
(its `this.trigger` call hits a non-existent method) so applicable_charges
recalculate correctly when rows are deleted from items or taxes.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Mirrors the salary-component pattern for two more pieces of master data:
- sync_leave_types(): full upsert from default_data/leave_types.json.
Creates missing, updates existing, deletes those no longer in JSON.
Leave Type has no `disabled` field, so when a deletion fails due to
linked Leave Allocation/Application records, the sync logs and skips
(vs. marking disabled like Salary Component does).
- sync_company_defaults(): for every Company, resolves each account_number
in default_data/company_defaults.json to the company-scoped Account
name and sets the corresponding Company field. Non-destructive: if
the company has no account with that number, the field is left as-is.
Both hooked into after_migrate_combined after sync_salary_components,
since Leave Type's earning_component references a Salary Component.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds sync_salary_components() — full upsert from default_data JSON:
creates missing components, updates existing ones (formula, condition,
flags, accounts), and deletes those no longer in the JSON. If a
component cannot be deleted due to linked records, it is marked
disabled instead. Idempotent and safe to re-run.
Hooked into after_migrate_combined so every "bench migrate" picks up
the latest formulas — single source of truth is the JSON file.
Replaced default_data/salary_components.json with the current
production export (14 components, formulas use the f(base) + g(LE)
pattern for separate ƏH/MK accounting).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replace per-field delete+create loop (which forced ALTER TABLE on all 222
custom fields every migrate) with idempotent bulk update that only writes
when a field's definition actually changed. Saves with ignore_version=True
to bypass the Frappe Version diff bug that crashes on certain int values.
Also remove the top-level create_custom_fields() call so the function only
runs from after_migrate, not on every module import.
Optional JEY_ERP_FORCE_RECREATE_FIELDS=1 env var preserves the old
delete+create path for development.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds six new collapsible sections at the very end of the Tax Policy
tab on Company form, each with an HTML field for a reference-data
table rendered by invoice_az/client/company.js:
- E-Taxes Objects
- Cash Registers
- POS Terminals
- Bank Accounts
- Obligation Pacts
- Presented Certificates
Tax Closing Wizards moved to the bottom (insert_after changed from
accounting_method to presented_certificates_list_html) so wizards
sit under the new sections.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds a Tax Free tab to Salary Slip with 4 nested sub-tabs (Vergi, MDSS,
İşsizlik sığorta, İcbari Tibbi Sığorta) rendered via the custom_subtabs
app. Each sub-tab has a Göstəricilər (Link to Tax Free Indicator, filtered
by group) and an Amount (Currency) field arranged in two columns.
Introduces a new Tax Free Indicator tree DocType mirroring the tax_article
pattern from taxes_az, seeded via fixtures with 74 indicators scraped from
the e-taxes.gov.az unified declaration (32 Vergi + 30 MDSS + 5 İşsizlik
+ 7 İcbari Tibbi Sığorta) grouped under 4 roots.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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>
Removed account_tree_custom.js which caused console errors due to
accessing undefined treeview fields. Export functionality is already
available via account_list.js.
Added CSS fix for Chart of Accounts tree view where account balances
were visually shifted down by one row due to float:right on balance-area.
Fix uses flexbox on tree nodes instead.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Export: company_export.py exports all Link-to-Account fields as account_name
- Import: create_default_company_accounts() resolves account names to full accounts in new company, applied via setup_wizard_complete
- JS: Export Defaults button in Company list view downloads company_defaults.json
- default_data/company_defaults.json: initial defaults
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Fields added as Small Text (TEXT in MySQL) to bypass tabEmployee's 65535-byte
row size limit. Added two pre_model_sync patches to fix row format and add
columns directly before Frappe schema sync runs.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds a Select field 'Absence Reason' visible only when status is Absent,
with 12 predefined Azerbaijani-language absence reason options.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>