From 2fa34fcfef9d48465e38e46c3cf4efae0ba58ff9 Mon Sep 17 00:00:00 2001 From: Simon Lejeune Date: Mon, 28 Sep 2015 17:37:00 +0200 Subject: [PATCH] [REF] report: remove css parsing from get_pdf Useless now that rev f26988c allows the use of asset. Also, it was partly used to retrieve the content of the `report.style` template that was removed by rev c9492f8. The preferred way to add local style and stylesheets is to add them directly in the assets. --- addons/report/models/report.py | 10 +++------- addons/report/views/layouts.xml | 1 - 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/addons/report/models/report.py b/addons/report/models/report.py index 7ba71a1f79e..5963bbef56f 100644 --- a/addons/report/models/report.py +++ b/addons/report/models/report.py @@ -165,7 +165,6 @@ class Report(osv.Model): paperformat = report.paperformat_id # Preparing the minimal html pages - css = '' # Will contain local css headerhtml = [] contenthtml = [] footerhtml = [] @@ -182,17 +181,14 @@ class Report(osv.Model): root = lxml.html.fromstring(html) match_klass = "//div[contains(concat(' ', normalize-space(@class), ' '), ' {} ')]" - for node in root.xpath("//html/head/style"): - css += node.text - for node in root.xpath(match_klass.format('header')): body = lxml.html.tostring(node) - header = render_minimal(dict(css=css, subst=True, body=body, base_url=base_url)) + header = render_minimal(dict(subst=True, body=body, base_url=base_url)) headerhtml.append(header) for node in root.xpath(match_klass.format('footer')): body = lxml.html.tostring(node) - footer = render_minimal(dict(css=css, subst=True, body=body, base_url=base_url)) + footer = render_minimal(dict(subst=True, body=body, base_url=base_url)) footerhtml.append(footer) for node in root.xpath(match_klass.format('page')): @@ -213,7 +209,7 @@ class Report(osv.Model): # Extract the body body = lxml.html.tostring(node) - reportcontent = render_minimal(dict(css=css, subst=False, body=body, base_url=base_url)) + reportcontent = render_minimal(dict(subst=False, body=body, base_url=base_url)) contenthtml.append(tuple([reportid, reportcontent])) diff --git a/addons/report/views/layouts.xml b/addons/report/views/layouts.xml index acbabe608dc..afabd91df46 100644 --- a/addons/report/views/layouts.xml +++ b/addons/report/views/layouts.xml @@ -162,7 +162,6 @@ -