1010from frappe .utils import get_html_format
1111
1212
13-
1413@frappe .whitelist ()
1514def get_script (report_name ):
1615 report = get_report_doc (report_name )
@@ -21,23 +20,20 @@ def get_script(report_name):
2120 # custom modules are virtual modules those exists in DB but not in disk.
2221 module_path = "" if is_custom_module else get_module_path (module )
2322 report_folder = module_path and os .path .join (module_path , "report" , scrub (report .name ))
24-
25- report_override_js = frappe .get_hooks ("report_override_js" , {})
26- if report_override_js .get (report_name ):
27- script_path = os .path .join (frappe .get_app_path ("test" ), report_override_js .get (report_name )[0 ])
28- else :
29- script_path = report_folder and os .path .join (report_folder , scrub (report .name ) + ".js" )
23+ script_path = report_folder and os .path .join (report_folder , scrub (report .name ) + ".js" )
24+ print_path = report_folder and os .path .join (report_folder , scrub (report .name ) + ".html" )
3025
3126 script = None
3227 if os .path .exists (script_path ):
3328 with open (script_path ) as f :
3429 script = f .read ()
3530 script += f"\n \n //# sourceURL={ scrub (report .name )} .js"
36-
31+
3732 if report_print := frappe .db .get_value (
38- "Report Print Format" , {"default" : 1 , "report" : report .name , "disabled" : 0 }, "html"
33+ "Report Print Format" , {"default" : 1 , "report" : report .name , "disabled" : 0 }, [ "html" , "css" ]
3934 ):
40- html_format = report_print
35+ html , css = report_print
36+ html_format = f"<style>{ css } </style>\n { html } "
4137 else :
4238 print_path = report_folder and os .path .join (
4339 report_folder , scrub (report .name ) + ".html"
@@ -54,7 +50,7 @@ def get_script(report_name):
5450 return {
5551 "script" : render_include (script ),
5652 "html_format" : html_format ,
57- "execution_time" : 0 ,
53+ "execution_time" : frappe . cache . hget ( "report_execution_time" , report_name ) or 0 ,
5854 "filters" : report .filters ,
5955 "custom_report_name" : report .name if report .get ("is_custom_report" ) else None ,
6056 }
0 commit comments