[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.
This commit is contained in:
Simon Lejeune
2015-09-28 18:17:16 +02:00
parent fa4b170a31
commit 2fa34fcfef
2 changed files with 3 additions and 8 deletions
+3 -7
View File
@@ -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]))
-1
View File
@@ -162,7 +162,6 @@
<head>
<t t-call-assets="report.assets_pdf"/>
<t t-call-assets="report.assets_common"/>
<style type='text/css'><t t-raw="css"/></style>
<t t-if="subst is True">
<script>
function subst() {