[search criteria] [deprecated]
This commit is contained in:
parent
c209b4b27c
commit
cd90ad52f5
11 changed files with 6 additions and 88 deletions
|
|
@ -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';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue