From e88ab56df0703e801d1c4b3ca880618159225050 Mon Sep 17 00:00:00 2001 From: Ali <010109ali@gmail.com> Date: Wed, 20 May 2026 17:06:09 +0000 Subject: [PATCH] chore(bank-integration): remove completed standard_field code migration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit migrate_standard_field_codes_to_labels() rewrote Bank Integration Excel Column Mapping.standard_field from old machine codes to human-readable labels — a one-time compatibility fix after the storage format changed. The migration has done its job: the preset fixture already ships labels, and new sites create mappings via the UI dropdown (labels from the start), so old codes can only exist on databases that predate the format change. Drop the function, its code->label map, and the after_migrate call. Co-Authored-By: Claude Opus 4.7 (1M context) --- jey_erp/bank_integration/migrations.py | 42 -------------------------- jey_erp/hooks.py | 2 -- 2 files changed, 44 deletions(-) diff --git a/jey_erp/bank_integration/migrations.py b/jey_erp/bank_integration/migrations.py index 3ba3d70..64e5419 100644 --- a/jey_erp/bank_integration/migrations.py +++ b/jey_erp/bank_integration/migrations.py @@ -152,22 +152,6 @@ def rename_bip_purposes(): _rename_to_readable("Bank Integration Supplier", "BIS", "supplier_name") -_STANDARD_FIELD_CODE_TO_LABEL = { - "date": "Date", - "reference_number": "Reference Number", - "counterparty": "Counterparty", - "counterparty_tax_id": "Counterparty Tax ID (VOEN)", - "counterparty_iban": "Counterparty IBAN", - "amount": "Amount", - "debit": "Debit", - "credit": "Credit", - "direction": "Direction", - "currency": "Currency", - "purpose": "Purpose", - "description": "Description", -} - - _PRESET_FIELDS_TO_COPY = ( "header_row", "amount_mode", @@ -243,29 +227,3 @@ def copy_excel_preset_into_bank_integration(): if copied: frappe.db.commit() print(f"BI: copied File Format from preset '{chosen_preset_name}' into {copied} Bank Integration(s)") - - -def migrate_standard_field_codes_to_labels(): - """Rewrite Bank Integration Excel Column Mapping.standard_field from the old - machine codes ('date', 'reference_number', ...) to the new human-readable - labels stored by the doctype select options. Idempotent: rows already on a - label value are left alone.""" - if not frappe.db.exists("DocType", "Bank Integration Excel Column Mapping"): - return - rows = frappe.get_all( - "Bank Integration Excel Column Mapping", - filters={"standard_field": ["in", list(_STANDARD_FIELD_CODE_TO_LABEL.keys())]}, - fields=["name", "standard_field"], - ) - if not rows: - return - for r in rows: - label = _STANDARD_FIELD_CODE_TO_LABEL.get(r.standard_field) - if not label: - continue - frappe.db.set_value( - "Bank Integration Excel Column Mapping", r.name, - "standard_field", label, update_modified=False, - ) - frappe.db.commit() - print(f"BI: migrated {len(rows)} Excel column mapping(s) to human-readable labels") diff --git a/jey_erp/hooks.py b/jey_erp/hooks.py index 84533e8..3068c46 100644 --- a/jey_erp/hooks.py +++ b/jey_erp/hooks.py @@ -142,13 +142,11 @@ def after_migrate_combined(): from jey_erp.bank_integration.migrations import ( link_kb_bank_accounts_to_bi, rename_bip_purposes, - migrate_standard_field_codes_to_labels, copy_excel_preset_into_bank_integration, add_importer_link_to_invoicing_workspace, ) link_kb_bank_accounts_to_bi() rename_bip_purposes() - migrate_standard_field_codes_to_labels() copy_excel_preset_into_bank_integration() add_importer_link_to_invoicing_workspace() except Exception as e: