From 3d7e56d1ef1bd5a6abdaa7c86e9caa947fb8eb4b Mon Sep 17 00:00:00 2001 From: Saurabh Date: Wed, 18 Apr 2018 12:39:56 +0530 Subject: [PATCH] [fix] added ignore_in_install flag to accommodate Gcal custom field (#5455) --- .../doctype/data_migration_plan/data_migration_plan.py | 2 ++ frappe/installer.py | 2 ++ frappe/model/db_schema.py | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/frappe/data_migration/doctype/data_migration_plan/data_migration_plan.py b/frappe/data_migration/doctype/data_migration_plan/data_migration_plan.py index e85bb26b1a..5cd195f4fe 100644 --- a/frappe/data_migration/doctype/data_migration_plan/data_migration_plan.py +++ b/frappe/data_migration/doctype/data_migration_plan/data_migration_plan.py @@ -30,6 +30,7 @@ class DataMigrationPlan(Document): create_init_py(get_module_path(self.module), dt, dn) def make_custom_fields_for_mappings(self): + frappe.flags.ignore_in_install = True label = self.name + ' ID' fieldname = frappe.scrub(label) @@ -51,6 +52,7 @@ class DataMigrationPlan(Document): # Create custom field in Deleted Document create_custom_field('Deleted Document', df) + frappe.flags.ignore_in_install = False def pre_process_doc(self, mapping_name, doc): module = self.get_mapping_module(mapping_name) diff --git a/frappe/installer.py b/frappe/installer.py index fe4a18d972..740bb97774 100755 --- a/frappe/installer.py +++ b/frappe/installer.py @@ -108,6 +108,8 @@ def get_root_connection(root_login='root', root_password=None): def install_app(name, verbose=False, set_as_patched=True): frappe.flags.in_install = name + frappe.flags.ignore_in_install = False + frappe.clear_cache() app_hooks = frappe.get_hooks(app_name=name) installed_apps = frappe.get_installed_apps() diff --git a/frappe/model/db_schema.py b/frappe/model/db_schema.py index 33cdc70d94..6990b3d637 100644 --- a/frappe/model/db_schema.py +++ b/frappe/model/db_schema.py @@ -230,7 +230,7 @@ class DbTable: 'fieldtype': 'Text' }) - if not frappe.flags.in_install_db and frappe.flags.in_install != "frappe": + if not frappe.flags.in_install_db and (frappe.flags.in_install != "frappe" or frappe.flags.ignore_in_install): custom_fl = frappe.db.sql("""\ SELECT * FROM `tabCustom Field` WHERE dt = %s AND docstatus < 2""", (self.doctype,), as_dict=1)