summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorNaresh Choksy <nch@tinyerp.com>2009-06-29 11:47:10 +0530
committerNaresh Choksy <nch@tinyerp.com>2009-06-29 11:47:10 +0530
commitc790c9ff7d7d102e908ce40ec0b4e29dcbfd24aa (patch)
tree1ab8aa03b13adb5579b0b2a420f73035760baa1d /bin
parentaf536b3632e0e301a5a13fa45fbeb088fa47bd45 (diff)
parent6be08e18082d66aa55f6b0eaf5fb042b3ead03dd (diff)
[MERGE]
bzr revid: nch@tinyerp.com-20090629061710-ab6oydkwswc6d8mh
Diffstat (limited to 'bin')
-rw-r--r--bin/osv/orm.py18
-rw-r--r--bin/report/custom.py1
-rw-r--r--bin/report/render/rml2pdf/trml2pdf.py3
-rw-r--r--bin/report/render/rml2pdf/utils.py3
-rw-r--r--bin/report/report_sxw.py2
5 files changed, 23 insertions, 4 deletions
diff --git a/bin/osv/orm.py b/bin/osv/orm.py
index cedacb728b3..4d91e4a213f 100644
--- a/bin/osv/orm.py
+++ b/bin/osv/orm.py
@@ -653,9 +653,21 @@ class orm_template(object):
if warning:
cr.rollback()
return (-1, res, warning, '')
- id = self.pool.get('ir.model.data')._update(cr, uid, self._name,
- current_module, res, xml_id=data_id, mode=mode,
- noupdate=noupdate)
+
+ try:
+ id = self.pool.get('ir.model.data')._update(cr, uid, self._name,
+ current_module, res, xml_id=data_id, mode=mode,
+ noupdate=noupdate)
+ except Exception, e:
+ import psycopg2
+ if isinstance(e,psycopg2.IntegrityError):
+ msg= 'Insertion Failed!'
+ for key in self.pool._sql_error.keys():
+ if key in e[0]:
+ msg = self.pool._sql_error[key]
+ break
+ return (-1, res,msg,'' )
+
for lang in translate:
context2 = context.copy()
context2['lang'] = lang
diff --git a/bin/report/custom.py b/bin/report/custom.py
index f7ff8996875..4c0c9b1ece0 100644
--- a/bin/report/custom.py
+++ b/bin/report/custom.py
@@ -554,6 +554,7 @@ class report_custom(report_int):
abscissa.update(fields_bar[idx])
idx0 += 1
abscissa = map(lambda x : [x, None], abscissa)
+ abscissa.sort()
ar.x_coord = category_coord.T(abscissa,0)
ar.draw(can)
diff --git a/bin/report/render/rml2pdf/trml2pdf.py b/bin/report/render/rml2pdf/trml2pdf.py
index 7efda11382b..cae88ac5eef 100644
--- a/bin/report/render/rml2pdf/trml2pdf.py
+++ b/bin/report/render/rml2pdf/trml2pdf.py
@@ -236,16 +236,19 @@ class _rml_canvas(object):
def _drawString(self, node):
v = utils.attr_get(node, ['x','y'])
text=self._textual(node, **v)
+ text = utils.xml2str(text)
self.canvas.drawString(text=text, **v)
def _drawCenteredString(self, node):
v = utils.attr_get(node, ['x','y'])
text=self._textual(node, **v)
+ text = utils.xml2str(text)
self.canvas.drawCentredString(text=text, **v)
def _drawRightString(self, node):
v = utils.attr_get(node, ['x','y'])
text=self._textual(node, **v)
+ text = utils.xml2str(text)
self.canvas.drawRightString(text=text, **v)
def _rect(self, node):
diff --git a/bin/report/render/rml2pdf/utils.py b/bin/report/render/rml2pdf/utils.py
index 65fb2366c9a..b7f81ec24e4 100644
--- a/bin/report/render/rml2pdf/utils.py
+++ b/bin/report/render/rml2pdf/utils.py
@@ -47,6 +47,9 @@ _regex = re.compile('\[\[(.+?)\]\]')
def str2xml(s):
return s.replace('&', '&amp;').replace('<', '&lt;').replace('>', '&gt;')
+def xml2str(s):
+ return s.replace('&amp;','&').replace('&lt;','<').replace('&gt;','>')
+
def _child_get(node, self=None, tagname=None):
for n in node:
if self and self.localcontext and n.get('rml_loop', False):
diff --git a/bin/report/report_sxw.py b/bin/report/report_sxw.py
index 838e0d136d2..1f1b3a0b5be 100644
--- a/bin/report/report_sxw.py
+++ b/bin/report/report_sxw.py
@@ -305,7 +305,7 @@ class rml_parse(object):
head_dom = etree.XML(rml_head)
for tag in head_dom.getchildren():
found = rml_dom.find('.//'+tag.tag)
- if found:
+ if len(found):
if tag.get('position'):
found.append(tag)
else :