Skip to content

Commit 2329852

Browse files
committed
chore: linters
1 parent 4ad2c46 commit 2329852

2 files changed

Lines changed: 19 additions & 24 deletions

File tree

‎report_print/overrides/report.py‎

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
from frappe.utils import get_html_format
1111

1212

13-
1413
@frappe.whitelist()
1514
def 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
}

‎report_print/report_print/doctype/report_print_format/report_print_format.json‎

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"default",
1414
"section_break_6",
1515
"html",
16-
"css_section",
16+
"section_break_pbgd",
1717
"css"
1818
],
1919
"fields": [
@@ -49,30 +49,29 @@
4949
"oldfieldtype": "Text Editor",
5050
"options": "Jinja"
5151
},
52-
{
53-
"depends_on": "eval:!doc.raw_printing",
54-
"fieldname": "css_section",
55-
"fieldtype": "Section Break"
56-
},
57-
{
58-
"fieldname": "css",
59-
"fieldtype": "Code",
60-
"label": "Custom CSS",
61-
"options": "CSS"
62-
},
6352
{
6453
"default": "0",
6554
"fieldname": "default",
6655
"fieldtype": "Check",
6756
"label": "Default",
6857
"no_copy": 1,
6958
"read_only": 1
59+
},
60+
{
61+
"fieldname": "section_break_pbgd",
62+
"fieldtype": "Section Break"
63+
},
64+
{
65+
"fieldname": "css",
66+
"fieldtype": "Code",
67+
"label": "CSS",
68+
"options": "CSS"
7069
}
7170
],
7271
"icon": "fa fa-print",
7372
"index_web_pages_for_search": 1,
7473
"links": [],
75-
"modified": "2024-08-31 11:55:05.658178",
74+
"modified": "2025-08-30 00:29:50.389432",
7675
"modified_by": "Administrator",
7776
"module": "Report Print",
7877
"name": "Report Print Format",

0 commit comments

Comments
 (0)