diff options
| author | Laurent Smet <las@openerp.com> | 2017-04-07 09:56:03 +0200 |
|---|---|---|
| committer | Laurent Smet <las@openerp.com> | 2017-05-08 09:22:56 +0200 |
| commit | 3425752eaca236c1e4b4d616aa49b3faa6cfd957 (patch) | |
| tree | 5ad5c08176129dff99f072c71fc8211f8b56183f /odoo/report/render/html2html | |
| parent | 9898b125ad00aa2288017761297003a3a4e1ddb0 (diff) | |
[REM] odoo/report: remove deprecated stuff
- RML Reports
- Webkit Reports (most part already removed by 13b9982c6298021289707ed364e3c1d622a09f13)
- LocalService in netsvc.py
- rename attributes like rml_% to report_%
- rename ir.actions.report.xml to ir.actions.report
- allow rendering directly on an ir.actions.report by calling render method
- remove 'controller' report_type
- remove unused res.font stuff
- remove print_report method in models.py (not used)
- restore removed call to pdftotext process in test_reports
Diffstat (limited to 'odoo/report/render/html2html')
| -rw-r--r-- | odoo/report/render/html2html/__init__.py | 4 | ||||
| -rw-r--r-- | odoo/report/render/html2html/html2html.py | 76 |
2 files changed, 0 insertions, 80 deletions
diff --git a/odoo/report/render/html2html/__init__.py b/odoo/report/render/html2html/__init__.py deleted file mode 100644 index 41fa95cf4a0..00000000000 --- a/odoo/report/render/html2html/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# -*- coding: utf-8 -*- -# Part of Odoo. See LICENSE file for full copyright and licensing details. - -from .html2html import parseString diff --git a/odoo/report/render/html2html/html2html.py b/odoo/report/render/html2html/html2html.py deleted file mode 100644 index bb6ea8bae0d..00000000000 --- a/odoo/report/render/html2html/html2html.py +++ /dev/null @@ -1,76 +0,0 @@ -# -*- coding: utf-8 -*- -# Part of Odoo. See LICENSE file for full copyright and licensing details. - -import base64 -import copy -import cStringIO -import re - -from reportlab.lib.utils import ImageReader - -from odoo.report.render.rml2pdf import utils - -_regex = re.compile('\[\[(.+?)\]\]') -utils._regex = re.compile('\[\[\s*(.+?)\s*\]\]',re.DOTALL) -class html2html(object): - def __init__(self, html, localcontext): - self.localcontext = localcontext - self.etree = html - self._node = None - - - def render(self): - def process_text(node,new_node): - if new_node.tag in ['story','tr','section']: - new_node.attrib.clear() - for child in utils._child_get(node, self): - new_child = copy.deepcopy(child) - new_node.append(new_child) - if len(child): - for n in new_child: - new_child.text = utils._process_text(self, child.text) - new_child.tail = utils._process_text(self, child.tail) - new_child.remove(n) - process_text(child, new_child) - else: - if new_child.tag=='img' and new_child.get('name'): - if _regex.findall(new_child.get('name')) : - src = utils._process_text(self, new_child.get('name')) - if src : - new_child.set('src','data:image/gif;base64,%s'%src) - output = cStringIO.StringIO(base64.decodestring(src)) - img = ImageReader(output) - (width,height) = img.getSize() - if not new_child.get('width'): - new_child.set('width',str(width)) - if not new_child.get('height') : - new_child.set('height',str(height)) - else : - new_child.getparent().remove(new_child) - new_child.text = utils._process_text(self, child.text) - new_child.tail = utils._process_text(self, child.tail) - self._node = copy.deepcopy(self.etree) - for n in self._node: - self._node.remove(n) - process_text(self.etree, self._node) - return self._node - - def url_modify(self,root): - for n in root: - if (n.text.find('<a ')>=0 or n.text.find('<a')>=0) and n.text.find('href')>=0 and n.text.find('style')<=0 : - node = (n.tag=='span' and n.getparent().tag=='u') and n.getparent().getparent() or ((n.tag=='span') and n.getparent()) or n - style = node.get('color') and "style='color:%s; text-decoration: none;'"%node.get('color') or '' - if n.text.find('<a')>=0: - t = '<a ' - else : - t = '<a ' - href = n.text.split(t)[-1] - n.text = ' '.join([t,style,href]) - self.url_modify(n) - return root - -def parseString(node, localcontext = {}): - r = html2html(node, localcontext) - root = r.render() - root = r.url_modify(root) - return root |
