summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNaresh Choksy <nch@tinyerp.com>2009-05-12 16:49:55 +0530
committerNaresh Choksy <nch@tinyerp.com>2009-05-12 16:49:55 +0530
commit9fa12bafaa9cd78c43490be36fcb76b3d197b7ea (patch)
treebc484eb4f16cf5e691e0436aa89d7b0ca2ab4cb4
parentc54fa973e060dceb6da89a4160ce32d8dbe408a0 (diff)
Bugfix:setTag
bzr revid: nch@tinyerp.com-20090512111955-x70z0zu770k0qq8x
-rw-r--r--bin/report/render/rml2pdf/trml2pdf.py6
-rw-r--r--bin/report/render/rml2pdf/utils.py14
-rw-r--r--bin/report/report_sxw.py12
3 files changed, 20 insertions, 12 deletions
diff --git a/bin/report/render/rml2pdf/trml2pdf.py b/bin/report/render/rml2pdf/trml2pdf.py
index efde722f0ed..a7741e9b76e 100644
--- a/bin/report/render/rml2pdf/trml2pdf.py
+++ b/bin/report/render/rml2pdf/trml2pdf.py
@@ -453,7 +453,7 @@ class _rml_flowable(object):
return rc1
def _table(self, node):
- childs = utils._child_get(node,self,'tr')
+ childs = list(utils._child_get(node,self,'tr'))
if not childs:
return None
length = 0
@@ -474,7 +474,7 @@ class _rml_flowable(object):
paraStyle = self.styles.styles[tr.get('paraStyle')]
data2 = []
posx = 0
- for td in utils._child_get(tr, self,'td'):
+ for td in list(utils._child_get(tr, self,'td')):
if td.get('style'):
st = copy.deepcopy(self.styles.table_styles[td.get('style')])
for s in st._cmds:
@@ -489,7 +489,7 @@ class _rml_flowable(object):
posx += 1
flow = []
- for n in utils._child_get(td, self):
+ for n in list(utils._child_get(td, self)):
fl = self._flowable(n, extra_style=paraStyle)
if isinstance(fl,list):
flow += fl
diff --git a/bin/report/render/rml2pdf/utils.py b/bin/report/render/rml2pdf/utils.py
index 2102912e974..ce54c50a9a5 100644
--- a/bin/report/render/rml2pdf/utils.py
+++ b/bin/report/render/rml2pdf/utils.py
@@ -40,6 +40,7 @@
import re
import reportlab
from lxml import etree
+import copy
_regex = re.compile('\[\[(.+?)\]\]')
@@ -47,6 +48,7 @@ def _child_get(node, self=None, tagname=None):
for n in node:
if self and self.localcontext and n.get('rml_loop', False):
oldctx = self.localcontext
+
for ctx in eval(n.get('rml_loop'),{}, self.localcontext):
self.localcontext.update(ctx)
if (tagname is None) or (n.tag==tagname):
@@ -58,7 +60,7 @@ def _child_get(node, self=None, tagname=None):
if n.get('rml_tag'):
try:
(tag,attr) = eval(n.get('rml_tag'),{}, self.localcontext)
- n2 = copy.copy(n)
+ n2 = copy.deepcopy(n)
n2.tag = tag
n2.attrib.update(attr)
yield n2
@@ -73,6 +75,16 @@ def _child_get(node, self=None, tagname=None):
eval(n.get('rml_except'), {}, self.localcontext)
except:
continue
+ if self and self.localcontext and n.get('rml_tag', False):
+ try:
+ (tag,attr) = eval(n.get('rml_tag'),{}, self.localcontext)
+ n2 = copy.deepcopy(n)
+ n2.tag = tag
+ n2.attrib.update(attr)
+ yield n2
+ tagname = ''
+ except:
+ pass
if (tagname is None) or (n.tag==tagname):
yield n
diff --git a/bin/report/report_sxw.py b/bin/report/report_sxw.py
index 426b738f338..9d2ca509470 100644
--- a/bin/report/report_sxw.py
+++ b/bin/report/report_sxw.py
@@ -199,11 +199,7 @@ class rml_parse(object):
def set_html_image(self,attach_id):
try :
att_id = int(attach_id)
- print att_id
attachment = self.pool.get('ir.attachment').browse(self.cr,self.uid,att_id)
- print attachment
- print attachment.datas
- return attachment.datas
except :
return ''
@@ -498,17 +494,17 @@ class report_sxw(report_rml, preprocess.report):
final_op = sxw_io.getvalue()
sxw_io.close()
return (final_op, report_type)
-
+
def create_single_html2html(self, cr, uid, ids, data, report_xml, context={}):
context = context.copy()
report_type = 'html'
- context['parents'] = html_parents
+ context['parents'] = html_parents
rml = report_xml.report_rml_content
rml_parser = self.parser(cr, uid, self.name2, context)
rml_parser.parents = html_parents
- rml_parser.tag = sxw_tag
+ rml_parser.tag = sxw_tag
objs = self.getObjects(cr, uid, ids, context)
rml_parser.set_context(objs, data, ids, report_type)
@@ -518,6 +514,6 @@ class report_sxw(report_rml, preprocess.report):
html = etree.tostring(create_doc(rml_dom, rml_parser.localcontext))
return (html, report_type)
-
+