|
|
@@ -16,11 +16,21 @@ import webnotes.widgets.reportview |
|
|
|
def get_script(report_name): |
|
|
|
report = webnotes.doc("Report", report_name) |
|
|
|
|
|
|
|
script_path = os.path.join(get_module_path(webnotes.conn.get_value("DocType", report.ref_doctype, "module")), |
|
|
|
doctype = webnotes.conn.get_value("DocType", report.ref_doctype, "module") |
|
|
|
script_path = os.path.join(get_module_path(doctype), |
|
|
|
"report", scrub(report.name), scrub(report.name) + ".js") |
|
|
|
|
|
|
|
locale_path = os.path.join(get_module_path(webnotes.conn.get_value(doctype)), |
|
|
|
"report", scrub(report.name)) |
|
|
|
if os.path.exists(script_path): |
|
|
|
with open(script_path, "r") as script: |
|
|
|
# load translations |
|
|
|
if webnotes.lang != "en": |
|
|
|
from webnotes.modules import get_doc_path |
|
|
|
from webnotes.translate import get_lang_data |
|
|
|
#d = doclist[0] |
|
|
|
messages = get_lang_data(locale_path, |
|
|
|
webnotes.lang, 'js') |
|
|
|
webnotes.response["__messages"] = messages |
|
|
|
return script.read() |
|
|
|
elif report.javascript: |
|
|
|
return report.javascript |
|
|
|