diff --git a/frappe/custom/doctype/custom_field/custom_field.py b/frappe/custom/doctype/custom_field/custom_field.py index 274ff2f8c7..40cca1cb15 100644 --- a/frappe/custom/doctype/custom_field/custom_field.py +++ b/frappe/custom/doctype/custom_field/custom_field.py @@ -33,6 +33,8 @@ class CustomField(Document): if not self.idx: self.idx = len(fieldnames) + 1 + self._old_fieldtype = self.db_get('fieldtype') + if not self.fieldname: frappe.throw(_("Fieldname not set for Custom Field")) @@ -44,9 +46,10 @@ class CustomField(Document): validate_fields_for_doctype(self.dt) # update the schema - # if not frappe.flags.in_test: - from frappe.model.db_schema import updatedb - updatedb(self.dt) + if (self.fieldname not in frappe.db.get_table_columns(self.dt) + or self._old_fieldtype != self.fieldtype): + from frappe.model.db_schema import updatedb + updatedb(self.dt) def on_trash(self): # delete property setter entries diff --git a/frappe/utils/fixtures.py b/frappe/utils/fixtures.py index c82ae2170b..fcb78cc868 100644 --- a/frappe/utils/fixtures.py +++ b/frappe/utils/fixtures.py @@ -20,7 +20,8 @@ def sync_fixtures(app=None): fixture_files = sorted(os.listdir(frappe.get_app_path(app, "fixtures"))) for fname in fixture_files: if fname.endswith(".json") or fname.endswith(".csv"): - import_doc(frappe.get_app_path(app, "fixtures", fname), ignore_links=True, overwrite=True) + import_doc(frappe.get_app_path(app, "fixtures", fname), + ignore_links=True, overwrite=True) import_custom_scripts(app) diff --git a/frappe/website/website_generator.py b/frappe/website/website_generator.py index c442bf88de..51129adada 100644 --- a/frappe/website/website_generator.py +++ b/frappe/website/website_generator.py @@ -15,7 +15,7 @@ class WebsiteGenerator(Document): website = frappe._dict( page_title_field = "name" ) - + def __init__(self, *args, **kwargs): self.route = None super(WebsiteGenerator, self).__init__(*args, **kwargs) @@ -35,7 +35,7 @@ class WebsiteGenerator(Document): self.route = self.make_route() if self.route: - self.route = self.route.strip('/.') + self.route = self.route.strip('/.')[:140] def make_route(self): return self.scrub(self.get(self.website.page_title_field or "name"))