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: