'Update database schema, make controller templates if `custom` is not set and clear cache.'

def on_update(self):

    from frappe.model.db_schema import updatedb
    updatedb(self.name, self)
    self.change_modified_of_parent()
    make_module_and_roles(self)
    self.update_fields_to_fetch()
    from frappe import conf
    if ((not self.custom) and (not (frappe.flags.in_import or frappe.flags.in_test)) and conf.get(u'developer_mode')):
        self.export_doc()
        self.make_controller_template()
        if self.has_web_view:
            self.set_base_class_for_controller()
    if (not self.custom):
        self.run_module_method(u'on_doctype_update')
        if self.flags.in_insert:
            self.run_module_method(u'after_doctype_insert')
    delete_notification_count_for(doctype=self.name)
    frappe.clear_cache(doctype=self.name)
    if ((not frappe.flags.in_install) and hasattr(self, u'before_update')):
        self.sync_global_search()
    if (self.name in frappe.local.meta_cache):
        del frappe.local.meta_cache[self.name]
