diff --git a/core/doctype/customize_form/customize_form.js b/core/doctype/customize_form/customize_form.js index de99cecb4e..366658c29a 100644 --- a/core/doctype/customize_form/customize_form.js +++ b/core/doctype/customize_form/customize_form.js @@ -40,7 +40,7 @@ cur_frm.fields_dict.doc_type.get_query = function(doc, dt, dn) { WHERE ((IFNULL(issingle,0)=0 AND \ IFNULL(in_create, 0)=0 AND \ name not in ("DocType", "DocField", "DocPerm", "Profile", "Role", "UserRole", "Page", \ - "Page Role", "Module Def", "Print Format", "Report", "Search Criteria")) \ + "Page Role", "Module Def", "Print Format", "Report")) \ or name = "Item Group") \ AND name LIKE "%s%%" ORDER BY name ASC LIMIT 50'; } diff --git a/core/doctype/doctype/doctype.py b/core/doctype/doctype/doctype.py index f5d4a755af..c8b29b23a4 100644 --- a/core/doctype/doctype/doctype.py +++ b/core/doctype/doctype/doctype.py @@ -107,7 +107,7 @@ class DocType: webnotes.conn.sql("delete from `tabCustom Field` where dt = %s", self.doc.name) webnotes.conn.sql("delete from `tabCustom Script` where dt = %s", self.doc.name) webnotes.conn.sql("delete from `tabProperty Setter` where doc_type = %s", self.doc.name) - webnotes.conn.sql("delete from `tabSearch Criteria` where doc_type = %s", self.doc.name) + webnotes.conn.sql("delete from `tabReport` where ref_doctype=%s", self.doc.name) def on_rename(self, new, old, merge=False): if self.doc.issingle: diff --git a/public/build.json b/public/build.json index 7a4adb3c6c..81913bad7e 100644 --- a/public/build.json +++ b/public/build.json @@ -1,15 +1,4 @@ [ - - { - "public/js/report-legacy.min.js": [ - "lib/public/js/legacy/widgets/tabbedpage.js", - "lib/public/js/legacy/widgets/report_builder/report_builder.js", - "lib/public/js/legacy/widgets/report_builder/datatable.js", - "lib/public/js/legacy/widgets/report_builder/calculator.js", - "lib/public/js/legacy/widgets/print_query.js" - ] - }, - { "public/css/all-web.css": [ "lib/public/css/bootstrap.css", diff --git a/webnotes/__init__.py b/webnotes/__init__.py index a9b31472fb..8668712ff9 100644 --- a/webnotes/__init__.py +++ b/webnotes/__init__.py @@ -26,16 +26,6 @@ globals attached to webnotes module from __future__ import unicode_literals -code_fields_dict = { - 'Page':[('script', 'js'), ('content', 'html'), ('style', 'css'), ('static_content', 'html'), ('server_code', 'py')], - 'DocType':[('server_code_core', 'py'), ('client_script_core', 'js')], - 'Search Criteria':[('report_script', 'js'), ('server_script', 'py'), ('custom_query', 'sql')], - 'Patch':[('patch_code', 'py')], - 'Stylesheet':['stylesheet', 'css'], - 'Page Template':['template', 'html'], - 'Control Panel':[('startup_code', 'js'), ('startup_css', 'css')] -} - class _dict(dict): """dict like object that exposes keys as attributes""" def __getattr__(self, key): diff --git a/webnotes/model/__init__.py b/webnotes/model/__init__.py index 30d800d92a..41589ba764 100644 --- a/webnotes/model/__init__.py +++ b/webnotes/model/__init__.py @@ -49,18 +49,6 @@ def delete_doc(doctype=None, name=None, doclist = None, force=0): import webnotes.model.utils return webnotes.model.utils.delete_doc(doctype, name, doclist, force) -def get_search_criteria(dt): - import webnotes.model.doc - # load search criteria for reports (all) - dl = [] - try: # bc - sc_list = webnotes.conn.sql("select name from `tabSearch Criteria` where doc_type = '%s' or parent_doc_type = '%s' and (disabled!=1 OR disabled IS NULL)" % (dt, dt)) - for sc in sc_list: - dl += webnotes.model.doc.get('Search Criteria', sc[0]) - except Exception, e: - pass # no search criteria - return dl - def rename(doctype, old, new, debug=False): import webnotes.model.rename_doc webnotes.model.rename_doc.rename_doc(doctype, old, new, debug) diff --git a/webnotes/model/code.py b/webnotes/model/code.py index dceedef96e..b1b373a8f9 100644 --- a/webnotes/model/code.py +++ b/webnotes/model/code.py @@ -182,7 +182,7 @@ def get_code(module, dt, dn, extn, fieldname=None): return '' # file names - if dt in ('Page','Doctype','Search Criteria'): + if dt in ('Page','Doctype'): dt, dn = scrub(dt), scrub(dn) # get file name diff --git a/webnotes/model/doc.py b/webnotes/model/doc.py index bf31533288..f823100ccb 100755 --- a/webnotes/model/doc.py +++ b/webnotes/model/doc.py @@ -621,14 +621,6 @@ def check_page_perm(doc): webnotes.response['403'] = 1 raise webnotes.PermissionError, '[WNF] No read permission for %s %s' % ('Page', doc.name) -def get_report_builder_code(doc): - if doc.doctype=='Search Criteria': - from webnotes.model.code import get_code - - if doc.standard != 'No': - doc.report_script = get_code(doc.module, 'Search Criteria', doc.name, 'js') - doc.custom_query = get_code(doc.module, 'Search Criteria', doc.name, 'sql') - def get(dt, dn='', with_children = 1, from_controller = 0, prefix = 'tab'): """ Returns a doclist containing the main record and all child records @@ -657,10 +649,6 @@ def get(dt, dn='', with_children = 1, from_controller = 0, prefix = 'tab'): for t in tablefields: doclist += getchildren(doc.name, t[0], t[1], dt, prefix=prefix) - # import report_builder code - if not from_controller: - get_report_builder_code(doc) - return doclist def getsingle(doctype): diff --git a/webnotes/modules/__init__.py b/webnotes/modules/__init__.py index 17b31fc5a5..0c1c55a6a3 100644 --- a/webnotes/modules/__init__.py +++ b/webnotes/modules/__init__.py @@ -26,22 +26,9 @@ from __future__ import unicode_literals """ import webnotes, os, conf -transfer_types = ['Role', 'Print Format','DocType','Page','DocType Mapper', - 'Search Criteria', 'Patch', 'Report'] - -lower_case_files_for = ['DocType', 'Page', 'Search Criteria', 'Report', +lower_case_files_for = ['DocType', 'Page', 'Report', "Workflow", 'Module Def', 'Desktop Item', 'Workflow State', 'Workflow Action'] -code_fields_dict = { - 'Page':[('script', 'js'), ('content', 'html'), ('style', 'css'), ('static_content', 'html'), ('server_code', 'py')], - 'DocType':[('server_code_core', 'py'), ('client_script_core', 'js')], - 'Search Criteria':[('report_script', 'js'), ('server_script', 'py'), ('custom_query', 'sql')], - 'Patch':[('patch_code', 'py')], - 'Stylesheet':['stylesheet', 'css'], - 'Page Template':['template', 'html'], - 'Control Panel':[('startup_code', 'js'), ('startup_css', 'css')] -} - def scrub(txt): return txt.replace(' ','_').replace('-', '_').replace('/', '_').lower() diff --git a/webnotes/modules/export_file.py b/webnotes/modules/export_file.py index cd71d16cd7..7d9c1f2377 100644 --- a/webnotes/modules/export_file.py +++ b/webnotes/modules/export_file.py @@ -24,8 +24,7 @@ from __future__ import unicode_literals import webnotes, os import webnotes.model.doc -from webnotes.modules import scrub, get_module_path, lower_case_files_for, \ - code_fields_dict, scrub_dt_dn +from webnotes.modules import scrub, get_module_path, lower_case_files_for, scrub_dt_dn def export_doc(doc): export_to_files([[doc.doctype, doc.name]]) @@ -54,9 +53,6 @@ def write_document_file(doclist, record_module=None): # create folder folder = create_folder(module, doclist[0]['doctype'], doclist[0]['name'], code_type) - # separate code files - clear_code_fields(doclist, folder, code_type) - # write the data file fname = (code_type and scrub(doclist[0]['name'])) or doclist[0]['name'] with open(os.path.join(folder, fname +'.txt'),'w+') as txtfile: @@ -120,11 +116,3 @@ def create_init_py(module_path, dt, dn): create_if_not_exists(os.path.join(module_path)) create_if_not_exists(os.path.join(module_path, dt)) create_if_not_exists(os.path.join(module_path, dt, dn)) - - -def clear_code_fields(doclist, folder, code_type): - code_fields = code_fields_dict.get(doclist[0]['doctype'], []) - for code_field in code_fields: - if doclist[0].get(code_field[0]): - doclist[0][code_field[0]] = None - diff --git a/webnotes/modules/utils.py b/webnotes/modules/utils.py index f03566d50a..8eaa46e58a 100644 --- a/webnotes/modules/utils.py +++ b/webnotes/modules/utils.py @@ -50,7 +50,7 @@ def switch_module(dt, dn, to, frm=None, export=None): export_doc(dt, dn) # copy code files - if dt in ('DocType', 'Page', 'Search Criteria', 'Report'): + if dt in ('DocType', 'Page', 'Report'): from_path = os.path.join(get_module_path(frm), scrub(dt), scrub(dn), scrub(dn)) to_path = os.path.join(get_module_path(to), scrub(dt), scrub(dn), scrub(dn)) diff --git a/webnotes/widgets/query_builder.py b/webnotes/widgets/query_builder.py index a49be13bcc..cebfb76ef4 100644 --- a/webnotes/widgets/query_builder.py +++ b/webnotes/widgets/query_builder.py @@ -248,18 +248,6 @@ def runquery(q='', ret=0, from_export=0): # run server script # ----------------- style, header_html, footer_html, page_template = '', '', '', '' - if webnotes.form_dict.get('sc_id'): - sc_id = webnotes.form_dict.get('sc_id') - from webnotes.model.code import get_code - sc_details = webnotes.conn.sql("select module, standard, server_script from `tabSearch Criteria` where name=%s", sc_id)[0] - if sc_details[1]!='No': - code = get_code(sc_details[0], 'Search Criteria', sc_id, 'py') - else: - code = sc_details[2] - - if code: - filter_values = eval(webnotes.form_dict.get('filter_values','')) or {} - res, style, header_html, footer_html, page_template = exec_report(code, res, colnames, colwidths, coltypes, coloptions, filter_values, q, from_export) out['colnames'] = colnames out['coltypes'] = coltypes