From 8d5e05d8debe119da665d568e6e29dc12ce8395b Mon Sep 17 00:00:00 2001 From: Tyler Matteson Date: Tue, 31 Mar 2026 16:15:19 -0400 Subject: [PATCH] chore: remove customize after migrate --- .pre-commit-config.yaml | 2 +- cloud_storage/customize.py | 48 -------------------------------------- cloud_storage/hooks.py | 5 ---- 3 files changed, 1 insertion(+), 54 deletions(-) delete mode 100644 cloud_storage/customize.py diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5a4355d..33b5660 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -45,7 +45,7 @@ repos: additional_dependencies: ['flake8-bugbear'] - repo: https://github.com/agritheory/test_utils - rev: v1.18.0 + rev: v1.20.4 hooks: - id: update_pre_commit_config - id: validate_frappe_project diff --git a/cloud_storage/customize.py b/cloud_storage/customize.py deleted file mode 100644 index 56a874e..0000000 --- a/cloud_storage/customize.py +++ /dev/null @@ -1,48 +0,0 @@ -# Copyright (c) 2025, AgriTheory and contributors -# For license information, please see license.txt - -import json -from pathlib import Path - -import frappe - - -def load_customizations(): - print("Loading Cloud Storage customizations") - customizations_directory = ( - Path().cwd().parent / "apps" / "cloud_storage" / "cloud_storage" / "cloud_storage" / "custom" - ) - files = list(customizations_directory.glob("**/*.json")) - for file in files: - customizations = json.loads(Path(file).read_text()) - for field in customizations.get("custom_fields"): - if field.get("module") != "Cloud Storage": - continue - existing_field = frappe.get_value("Custom Field", field.get("name")) - custom_field = ( - frappe.get_doc("Custom Field", field.get("name")) - if existing_field - else frappe.new_doc("Custom Field") - ) - field.pop("modified") - {custom_field.set(key, value) for key, value in field.items()} - custom_field.flags.ignore_permissions = True - custom_field.flags.ignore_version = True - custom_field.save() - for prop in customizations.get("property_setters"): - if field.get("module") != "Cloud Storage": - continue - property_setter = frappe.get_doc( - { - "name": prop.get("name"), - "doctype": "Property Setter", - "doctype_or_field": prop.get("doctype_or_field"), - "doc_type": prop.get("doc_type"), - "field_name": prop.get("field_name"), - "property": prop.get("property"), - "value": prop.get("value"), - "property_type": prop.get("property_type"), - } - ) - property_setter.flags.ignore_permissions = True - property_setter.insert() diff --git a/cloud_storage/hooks.py b/cloud_storage/hooks.py index f85b450..1f3161a 100644 --- a/cloud_storage/hooks.py +++ b/cloud_storage/hooks.py @@ -194,8 +194,3 @@ write_file = "cloud_storage.cloud_storage.overrides.file.write_file" delete_file_data_content = "cloud_storage.cloud_storage.overrides.file.delete_file" # cloud_storage_path_generator = "my_custom_app.utils.custom_get_file_path" - - -# After Migrate -# -------------------------------- -after_migrate = "cloud_storage.customize.load_customizations"