Bugfix:setTag
bzr revid: nch@tinyerp.com-20090512111955-x70z0zu770k0qq8x
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user