From 75c10f4003f08dcf680660621589ea9f12661b42 Mon Sep 17 00:00:00 2001 From: mbauskar Date: Thu, 23 Feb 2017 17:52:31 +0530 Subject: [PATCH] [fixes] update db schema while updating the customizations --- frappe/modules/utils.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/frappe/modules/utils.py b/frappe/modules/utils.py index 3e18350efa..6b09217444 100644 --- a/frappe/modules/utils.py +++ b/frappe/modules/utils.py @@ -101,6 +101,7 @@ def sync_customizations_for_doctype(data): from frappe.core.doctype.doctype.doctype import validate_fields_for_doctype doctype = data['doctype'] + update_schema = False def sync(key, custom_doctype, doctype_fieldname): frappe.db.sql('delete from `tab{0}` where `{1}`=%s'.format(custom_doctype, doctype_fieldname), @@ -113,6 +114,7 @@ def sync_customizations_for_doctype(data): if data['custom_fields']: sync('custom_fields', 'Custom Field', 'dt') + update_schema = True if data['property_setters']: sync('property_setters', 'Property Setter', 'doc_type') @@ -123,6 +125,10 @@ def sync_customizations_for_doctype(data): print 'Updating customizations for {0}'.format(doctype) validate_fields_for_doctype(doctype) + if update_schema and not frappe.db.get_value('DocType', doctype, 'issingle'): + from frappe.model.db_schema import updatedb + updatedb(doctype) + def scrub(txt): return frappe.scrub(txt)