diff --git a/frappe/custom/doctype/custom_field/custom_field.py b/frappe/custom/doctype/custom_field/custom_field.py index 3126326636..fb49aa5da0 100644 --- a/frappe/custom/doctype/custom_field/custom_field.py +++ b/frappe/custom/doctype/custom_field/custom_field.py @@ -68,14 +68,15 @@ class CustomField(Document): check_if_fieldname_conflicts_with_methods(self.dt, self.fieldname) def on_update(self): - frappe.clear_cache(doctype=self.dt) + if not frappe.flags.in_setup_wizard: + frappe.clear_cache(doctype=self.dt) if not self.flags.ignore_validate: # validate field from frappe.core.doctype.doctype.doctype import validate_fields_for_doctype validate_fields_for_doctype(self.dt) # update the schema - if not frappe.db.get_value('DocType', self.dt, 'issingle'): + if not frappe.db.get_value('DocType', self.dt, 'issingle') and not frappe.flags.in_setup_wizard: frappe.db.updatedb(self.dt) def on_trash(self): @@ -144,6 +145,10 @@ def create_custom_fields(custom_fields, ignore_validate = False, update=True): '''Add / update multiple custom fields :param custom_fields: example `{'Sales Invoice': [dict(fieldname='test')]}`''' + + if not ignore_validate and frappe.flags.in_setup_wizard: + ignore_validate = True + for doctype, fields in custom_fields.items(): if isinstance(fields, dict): # only one field @@ -163,6 +168,10 @@ def create_custom_fields(custom_fields, ignore_validate = False, update=True): custom_field.update(df) custom_field.save() + frappe.clear_cache(doctype=doctype) + frappe.db.updatedb(doctype) + + @frappe.whitelist() def add_custom_field(doctype, df): diff --git a/frappe/desk/page/setup_wizard/setup_wizard.py b/frappe/desk/page/setup_wizard/setup_wizard.py index c38cf47626..1ac5279508 100755 --- a/frappe/desk/page/setup_wizard/setup_wizard.py +++ b/frappe/desk/page/setup_wizard/setup_wizard.py @@ -124,6 +124,7 @@ def handle_setup_exception(args): frappe.db.rollback() if args: traceback = frappe.get_traceback() + print(traceback) for hook in frappe.get_hooks("setup_wizard_exception"): frappe.get_attr(hook)(traceback, args)