From fd65d126806f5a3b31cdb3f21e10dfb054aa8694 Mon Sep 17 00:00:00 2001
From: "nicolas.bessi@camptocamp.com" <>
Date: Fri, 22 Oct 2010 15:34:02 +0200
Subject: [PATCH 01/42] [FIX] RC2 fix of image embeeding, possibilit to have
tmp file name in same milisecond, imporvement of multi header support when
cusomizing report, fix of translation getter retunr scr if no translation
available
bzr revid: nicolas.bessi@camptocamp.com-20101022133402-bme1hmy4mtd7maa8
---
addons/report_webkit/report_helper.py | 2 +-
addons/report_webkit/webkit_report.py | 34 ++++++++++++++++-----------
2 files changed, 21 insertions(+), 15 deletions(-)
diff --git a/addons/report_webkit/report_helper.py b/addons/report_webkit/report_helper.py
index 80896fa4ba2..db0c1c372fc 100644
--- a/addons/report_webkit/report_helper.py
+++ b/addons/report_webkit/report_helper.py
@@ -51,7 +51,7 @@ class WebKitHelper(object):
height = 'width="%spx"'%(height)
else :
height = ' '
- toreturn = '
'%(
+ toreturn = '
'%(
width,
height,
type,
diff --git a/addons/report_webkit/webkit_report.py b/addons/report_webkit/webkit_report.py
index 3dd768128fb..5bdea865cde 100644
--- a/addons/report_webkit/webkit_report.py
+++ b/addons/report_webkit/webkit_report.py
@@ -84,8 +84,10 @@ class WebKitParser(report_sxw):
_('path to Wkhtmltopdf is not absolute'),
'for path %s'%(path)
)
- def generate_pdf(self, comm_path, report_xml, header, footer, html_list):
+ def generate_pdf(self, comm_path, report_xml, header, footer, html_list, webkit_header=False):
"""Call webkit in order to generate pdf"""
+ if not webkit_header:
+ webkit_header = report_xml.webkit_header
tmp_dir = tempfile.gettempdir()
out = report_xml.name+str(time.time())+'.pdf'
out = os.path.join(tmp_dir, out.replace(' ',''))
@@ -120,20 +122,22 @@ class WebKitParser(report_sxw):
file_to_del.append(foot_file.name)
command.append("--footer-html '%s'"%(foot_file.name))
- if report_xml.webkit_header.margin_top :
- command.append('--margin-top %s'%(report_xml.webkit_header.margin_top))
- if report_xml.webkit_header.margin_bottom :
- command.append('--margin-bottom %s'%(report_xml.webkit_header.margin_bottom))
- if report_xml.webkit_header.margin_left :
- command.append('--margin-left %s'%(report_xml.webkit_header.margin_left))
- if report_xml.webkit_header.margin_right :
- command.append('--margin-right %s'%(report_xml.webkit_header.margin_right))
- if report_xml.webkit_header.orientation :
- command.append("--orientation '%s'"%(report_xml.webkit_header.orientation))
- if report_xml.webkit_header.format :
- command.append(" --page-size '%s'"%(report_xml.webkit_header.format))
+ if webkit_header.margin_top :
+ command.append('--margin-top %s'%(webkit_header.margin_top))
+ if webkit_header.margin_bottom :
+ command.append('--margin-bottom %s'%(webkit_header.margin_bottom))
+ if webkit_header.margin_left :
+ command.append('--margin-left %s'%(webkit_header.margin_left))
+ if webkit_header.margin_right :
+ command.append('--margin-right %s'%(webkit_header.margin_right))
+ if webkit_header.orientation :
+ command.append("--orientation '%s'"%(webkit_header.orientation))
+ if webkit_header.format :
+ command.append(" --page-size '%s'"%(webkit_header.format))
+ count = 0
for html in html_list :
- html_file = file(os.path.join(tmp_dir, str(time.time()) + '.body.html'), 'w')
+ html_file = file(os.path.join(tmp_dir, str(time.time()) + str(count) +'.body.html'), 'w')
+ count += 1
html_file.write(html)
html_file.close()
file_to_del.append(html_file.name)
@@ -168,6 +172,8 @@ class WebKitParser(report_sxw):
"""Translate String."""
ir_translation = self.pool.get('ir.translation')
res = ir_translation._get_source(self.parser_instance.cr, self.parser_instance.uid, self.name, 'report', self.localcontext.get('lang', 'en_US'), src)
+ if not res :
+ return src
return res
def formatLang(self, value, digits=None, date=False, date_time=False, grouping=True, monetary=False):
From cdaef22f14104878cf21aba391c444cfe83e1abb Mon Sep 17 00:00:00 2001
From: "nicolas.bessi@camptocamp.com" <>
Date: Mon, 15 Nov 2010 11:17:59 +0100
Subject: [PATCH 02/42] [IMP] better debug-error message$
bzr revid: nicolas.bessi@camptocamp.com-20101115101759-vt2b1j03c9upbubn
---
addons/report_webkit/webkit_report.py | 82 +++++++++++++++------------
1 file changed, 47 insertions(+), 35 deletions(-)
diff --git a/addons/report_webkit/webkit_report.py b/addons/report_webkit/webkit_report.py
index cce410a9dc6..e05c8e5c437 100644
--- a/addons/report_webkit/webkit_report.py
+++ b/addons/report_webkit/webkit_report.py
@@ -35,7 +35,7 @@ import report
import tempfile
import time
from mako.template import Template
-
+from mako import exceptions
import netsvc
import pooler
from report_helper import WebKitHelper
@@ -278,45 +278,57 @@ class WebKitParser(report_sxw):
#default_filters=['unicode', 'entity'] can be used to set global filter
body_mako_tpl = Template(template ,input_encoding='utf-8')
helper = WebKitHelper(cursor, uid, report_xml.id, context)
- html = body_mako_tpl.render( helper=helper,
- css=css,
- _=self.translate_call,
- **self.parser_instance.localcontext
- )
+ try :
+ html = body_mako_tpl.render( helper=helper,
+ css=css,
+ _=self.translate_call,
+ **self.parser_instance.localcontext
+ )
+ except :
+ raise Exception(exceptions.html_error_template().render())
head_mako_tpl = Template(header, input_encoding='utf-8')
- head = head_mako_tpl.render(
- company=company,
- time=time,
- helper=helper,
- css=css,
- formatLang=self.formatLang,
- setLang=self.setLang,
- _=self.translate_call,
- _debug=False
- )
+ try :
+ head = head_mako_tpl.render(
+ company=company,
+ time=time,
+ helper=helper,
+ css=css,
+ formatLang=self.formatLang,
+ setLang=self.setLang,
+ _=self.translate_call,
+ _debug=False
+ )
+ except :
+ raise Exception(exceptions.html_error_template().render())
foot = False
if footer :
foot_mako_tpl = Template(footer ,input_encoding='utf-8')
- foot = foot_mako_tpl.render(
- company=company,
- time=time,
- helper=helper,
- css=css,
- formatLang=self.formatLang,
- setLang=self.setLang,
- _=self.translate_call,
- )
+ try :
+ foot = foot_mako_tpl.render(
+ company=company,
+ time=time,
+ helper=helper,
+ css=css,
+ formatLang=self.formatLang,
+ setLang=self.setLang,
+ _=self.translate_call,
+ )
+ except:
+ raise Exception(exceptions.html_error_template().render())
if report_xml.webkit_debug :
- deb = head_mako_tpl.render(
- company=company,
- time=time,
- helper=helper,
- css=css,
- _debug=html,
- formatLang=self.formatLang,
- setLang=self.setLang,
- _=self.translate_call,
- )
+ try :
+ deb = head_mako_tpl.render(
+ company=company,
+ time=time,
+ helper=helper,
+ css=css,
+ _debug=html,
+ formatLang=self.formatLang,
+ setLang=self.setLang,
+ _=self.translate_call,
+ )
+ except :
+ raise Exception(exceptions.html_error_template().render())
return (deb, 'html')
bin = self.get_lib(cursor, uid, company.id)
pdf = self.generate_pdf(bin, report_xml, head, foot, [html])
From 0716a455a609d62b1b5b1d2e5358c9c943a5646b Mon Sep 17 00:00:00 2001
From: "nicolas.bessi@camptocamp.com" <>
Date: Thu, 25 Nov 2010 16:50:35 +0100
Subject: [PATCH 03/42] Fixes as disscused with odony
bzr revid: nicolas.bessi@camptocamp.com-20101125155035-to0aj6i7ulygbwap
---
addons/report_webkit/webkit_report.py | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/addons/report_webkit/webkit_report.py b/addons/report_webkit/webkit_report.py
index e05c8e5c437..191c614a68f 100644
--- a/addons/report_webkit/webkit_report.py
+++ b/addons/report_webkit/webkit_report.py
@@ -284,8 +284,8 @@ class WebKitParser(report_sxw):
_=self.translate_call,
**self.parser_instance.localcontext
)
- except :
- raise Exception(exceptions.html_error_template().render())
+ except Exception, e:
+ raise except_osv(exceptions.html_error_template().render())
head_mako_tpl = Template(header, input_encoding='utf-8')
try :
head = head_mako_tpl.render(
@@ -298,8 +298,8 @@ class WebKitParser(report_sxw):
_=self.translate_call,
_debug=False
)
- except :
- raise Exception(exceptions.html_error_template().render())
+ except Exception, e:
+ raise except_osv(exceptions.html_error_template().render())
foot = False
if footer :
foot_mako_tpl = Template(footer ,input_encoding='utf-8')
@@ -314,7 +314,7 @@ class WebKitParser(report_sxw):
_=self.translate_call,
)
except:
- raise Exception(exceptions.html_error_template().render())
+ raise except_osv(exceptions.html_error_template().render())
if report_xml.webkit_debug :
try :
deb = head_mako_tpl.render(
@@ -327,8 +327,8 @@ class WebKitParser(report_sxw):
setLang=self.setLang,
_=self.translate_call,
)
- except :
- raise Exception(exceptions.html_error_template().render())
+ except Exception, e:
+ raise except_osv(exceptions.html_error_template().render())
return (deb, 'html')
bin = self.get_lib(cursor, uid, company.id)
pdf = self.generate_pdf(bin, report_xml, head, foot, [html])
From bc9bab7db406b0ed3c1b6fabf13c33c7b3929ccf Mon Sep 17 00:00:00 2001
From: "psi (Open ERP)"
Date: Thu, 2 Dec 2010 18:32:17 +0530
Subject: [PATCH 04/42] [IMP] account_voucher: misc changes and moveline with
same amount with higer priority
bzr revid: psi@tinyerp.co.in-20101202130217-siz1ozkcq5har3mv
---
addons/account/account_invoice_view.xml | 2 +-
addons/account_voucher/account_voucher.py | 17 +++++--
.../account_voucher_report.xml | 4 +-
.../report/account_voucher_print.rml | 51 -------------------
.../voucher_payment_receipt_view.xml | 2 +-
5 files changed, 18 insertions(+), 58 deletions(-)
diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml
index e5427a93361..9d10107c5c9 100644
--- a/addons/account/account_invoice_view.xml
+++ b/addons/account/account_invoice_view.xml
@@ -497,7 +497,7 @@
[('type','=','in_refund')]
{'type':'in_refund', 'journal_type': 'purchase_refund'}
- A vendor refund is a credit note from your supplier indicating that he refunds part or totality of the invoice sent to you.
+ A supplier refund is a credit note from your supplier indicating that he refunds part or totality of the invoice sent to you.
diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py
index f902810ac31..9d06d181ef2 100644
--- a/addons/account_voucher/account_voucher.py
+++ b/addons/account_voucher/account_voucher.py
@@ -418,6 +418,18 @@ class account_voucher(osv.osv):
ids.reverse()
moves = move_line_pool.browse(cr, uid, ids)
+ priority_moves = []
+ for line in moves:
+ original_amount = line.credit or line.debit or 0.0
+ if original_amount == price:
+ priority_moves.append(line)
+
+ if priority_moves:
+ for line in moves:
+ if line not in priority_moves:
+ priority_moves.append(line)
+ moves = priority_moves
+
company_currency = journal.company_id.currency_id.id
if company_currency != currency_id and ttype == 'payment':
total_debit = currency_pool.compute(cr, uid, currency_id, company_currency, total_debit)
@@ -438,13 +450,13 @@ class account_voucher(osv.osv):
if line.debit and line.reconcile_partial_id and ttype == 'payment':
continue
- orignal_amount = line.credit or line.debit or 0.0
+ original_amount = line.credit or line.debit or 0.0
rs = {
'name':line.move_id.name,
'type': line.credit and 'dr' or 'cr',
'move_line_id':line.id,
'account_id':line.account_id.id,
- 'amount_original':currency_pool.compute(cr, uid, company_currency, currency_id, orignal_amount),
+ 'amount_original':currency_pool.compute(cr, uid, company_currency, currency_id, original_amount),
'date_original':line.date,
'date_due':line.date_maturity,
'amount_unreconciled':currency_pool.compute(cr, uid, company_currency, currency_id, line.amount_unreconciled)
@@ -468,7 +480,6 @@ class account_voucher(osv.osv):
default['value']['pre_line'] = 1
elif ttype == 'receipt' and len(default['value']['line_dr_ids']) > 0:
default['value']['pre_line'] = 1
-
return default
def onchange_date(self, cr, user, ids, date, context={}):
diff --git a/addons/account_voucher/account_voucher_report.xml b/addons/account_voucher/account_voucher_report.xml
index 785fd91df73..8af204efbbe 100644
--- a/addons/account_voucher/account_voucher_report.xml
+++ b/addons/account_voucher/account_voucher_report.xml
@@ -1,7 +1,7 @@
-
+ menu="True"/> -->
-
-
-
-
-
- |
-
-
-
-
-
-
- |
-
-
-
-
- |
-
-
-
-
- |
-
-
-
-
- |
-
-
- |
- Receiver's Signature
- |
-
-
-
-
- |
-
-
-
-
- |
-
- Authorised Signatory
- |
-
-
-
-
-
diff --git a/addons/account_voucher/voucher_payment_receipt_view.xml b/addons/account_voucher/voucher_payment_receipt_view.xml
index 83b6243a627..0ed2bac22a5 100644
--- a/addons/account_voucher/voucher_payment_receipt_view.xml
+++ b/addons/account_voucher/voucher_payment_receipt_view.xml
@@ -224,7 +224,7 @@
- Vendor Payment
+ Supplier Payment
account.voucher
form
[('journal_id.type', 'in', ['bank', 'cash']), ('type','=','payment')]
From dd0510428f13eac487f07cc0739b53df46f668ab Mon Sep 17 00:00:00 2001
From: "P. Christeas"
Date: Fri, 3 Dec 2010 18:45:53 +0200
Subject: [PATCH 05/42] sql_db: only do frame inspection when debugging
This affects the "Cursor not closed explicitly..." message.
The message is at a "warning" level, but the frame inspection added
some expensive overhead to each cursor open. So, avoid that unless we
are at debug mode.
Conflicts:
bin/sql_db.py
bzr revid: p_christ@hol.gr-20101203164553-vudqkoqb0hpfsocj
---
bin/report/interface.py | 7 +-
bin/report/render/render.py | 18 +++-
bin/report/render/rml2pdf/trml2pdf.py | 122 ++++++++++++++++----------
3 files changed, 97 insertions(+), 50 deletions(-)
diff --git a/bin/report/interface.py b/bin/report/interface.py
index 703256d8fcd..6cec28b1c98 100644
--- a/bin/report/interface.py
+++ b/bin/report/interface.py
@@ -186,7 +186,7 @@ class report_rml(report_int):
else:
if 'logo' in self.bin_datas:
del self.bin_datas['logo']
- obj = render.rml(rml, localcontext, self.bin_datas, tools.config['root_path'],title)
+ obj = render.rml(rml, localcontext, self.bin_datas, self._get_path(), title)
obj.render()
return obj.get()
@@ -226,5 +226,10 @@ class report_rml(report_int):
obj.render()
return obj.get()
+ def _get_path(self):
+ ret = []
+ ret.append(self.tmpl.rsplit('/',1)[0]) # Same dir as the report rml
+ ret.append(tools.config['root_path'])
+ return ret
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/bin/report/render/render.py b/bin/report/render/render.py
index 5252288d53d..0d00701ee54 100644
--- a/bin/report/render/render.py
+++ b/bin/report/render/render.py
@@ -36,9 +36,23 @@ import threading
# _render
#
class render(object):
- def __init__(self, bin_datas={}, path='.'):
+ """ Represents a report job being rendered.
+
+ @param bin_datas a dictionary of name: of images etc.
+ @param path the path in which binary files can be discovered, useful
+ for components (images) of the report. It can be:
+ - a string, relative or absolute path to images
+ - a list, containing strings of paths.
+ If a string is absolute path, it will be opened as such, else
+ it will be passed to tools.file_open() which also considers zip
+ addons.
+ """
+ def __init__(self, bin_datas=None, path='.'):
self.done = False
- self.bin_datas = bin_datas
+ if bin_datas is None:
+ self.bin_datas = {}
+ else:
+ self.bin_datas = bin_datas
self.path = path
def _render(self):
diff --git a/bin/report/render/rml2pdf/trml2pdf.py b/bin/report/render/rml2pdf/trml2pdf.py
index cbe847eea1c..a964a962442 100644
--- a/bin/report/render/rml2pdf/trml2pdf.py
+++ b/bin/report/render/rml2pdf/trml2pdf.py
@@ -35,6 +35,7 @@ import base64
from reportlab.platypus.doctemplate import ActionFlowable
from tools.safe_eval import safe_eval as eval
from reportlab.lib.units import inch,cm,mm
+from tools.misc import file_open
from reportlab.pdfbase import pdfmetrics
try:
@@ -45,6 +46,27 @@ except ImportError:
encoding = 'utf-8'
+def _open_image(filename, path=None):
+ """Attempt to open a binary file and return the descriptor
+ """
+
+ if os.path.isfile(filename):
+ return open(filename, 'rb')
+ for p in (path or []):
+ if p and os.path.isabs(p):
+ fullpath = os.path.join(p, filename)
+ if os.path.isfile(fullpath):
+ return open(fullpath, 'rb')
+ try:
+ if p:
+ fullpath = os.path.join(p, filename)
+ else:
+ fullpath = filename
+ return file_open(fullpath)
+ except IOError:
+ pass
+ raise IOError("File %s cannot be found in image path" % filename)
+
class NumberedCanvas(canvas.Canvas):
def __init__(self, *args, **kwargs):
canvas.Canvas.__init__(self, *args, **kwargs)
@@ -296,6 +318,7 @@ class _rml_canvas(object):
self.images = images
self.path = path
self.title = title
+ self._logger = logging.getLogger('report.rml.canvas')
if self.title:
self.canvas.setTitle(self.title)
@@ -413,10 +436,13 @@ class _rml_canvas(object):
def _image(self, node):
import urllib
+ import urlparse
from reportlab.lib.utils import ImageReader
- if not node.get('file') :
+ nfile = node.get('file')
+ if not nfile:
if node.get('name'):
image_data = self.images[node.get('name')]
+ self._logger.debug("Image %s used", node.get('name'))
s = StringIO(image_data)
else:
if self.localcontext:
@@ -430,21 +456,30 @@ class _rml_canvas(object):
if image_data:
s = StringIO(image_data)
else:
+ self._logger.debug("No image data!")
return False
else:
- if node.get('file') in self.images:
- s = StringIO(self.images[node.get('file')])
+ if nfile in self.images:
+ s = StringIO(self.images[nfile])
else:
try:
- u = urllib.urlopen(str(node.get('file')))
- s = StringIO(u.read())
- except Exception:
- u = file(os.path.join(self.path,str(node.get('file'))), 'rb')
+ up = urlparse.urlparse(str(nfile))
+ except ValueError:
+ up = False
+ if up and up.scheme:
+ # RFC: do we really want to open external URLs?
+ # Are we safe from cross-site scripting or attacks?
+ self._logger.debug("Retrieve image from %s", nfile)
+ u = urllib.urlopen(str(nfile))
s = StringIO(u.read())
+ else:
+ self._logger.debug("Open image file %s ", nfile)
+ s = _open_image(nfile, path=self.path)
img = ImageReader(s)
(sx,sy) = img.getSize()
+ self._logger.debug("Image is %dx%d", sx, sy)
- args = {}
+ args = { 'x': 0.0, 'y': 0.0 }
for tag in ('width','height','x','y'):
if node.get(tag):
args[tag] = utils.unit_get(node.get(tag))
@@ -540,14 +575,29 @@ class _rml_draw(object):
cnv.render(self.node)
canvas.restoreState()
+class _rml_Illustration(platypus.flowables.Flowable):
+ def __init__(self, node, localcontext, styles, self2):
+ self.localcontext = (localcontext or {}).copy()
+ self.node = node
+ self.styles = styles
+ self.width = utils.unit_get(node.get('width'))
+ self.height = utils.unit_get(node.get('height'))
+ self.self2 = self2
+ def wrap(self, *args):
+ return (self.width, self.height)
+ def draw(self):
+ drw = _rml_draw(self.localcontext ,self.node,self.styles, images=self.self2.images, path=self.self2.path, title=self.self2.title)
+ drw.render(self.canv, None)
+
class _rml_flowable(object):
- def __init__(self, doc, localcontext, images={}, path='.', title=None):
+ def __init__(self, doc, localcontext, images=None, path='.', title=None):
self.localcontext = localcontext
self.doc = doc
self.styles = doc.styles
- self.images = images
+ self.images = images or {}
self.path = path
self.title = title
+ self._logger = logging.getLogger('report.rml.flowable')
def _textual(self, node):
rc1 = utils._process_text(self, node.text or '')
@@ -638,21 +688,7 @@ class _rml_flowable(object):
return table
def _illustration(self, node):
- class Illustration(platypus.flowables.Flowable):
- def __init__(self, node, localcontext, styles, self2):
- self.localcontext = (localcontext or {}).copy()
- self.node = node
- self.styles = styles
- self.width = utils.unit_get(node.get('width'))
- self.height = utils.unit_get(node.get('height'))
- self.self2 = self2
- def wrap(self, *args):
- return (self.width, self.height)
- def draw(self):
- canvas = self.canv
- drw = _rml_draw(self.localcontext ,self.node,self.styles, images=self.self2.images, path=self.self2.path, title=self.self2.title)
- drw.render(self.canv, None)
- return Illustration(node, self.localcontext, self.styles, self)
+ return _rml_Illustration(node, self.localcontext, self.styles, self)
def _textual_image(self, node):
return base64.decodestring(node.text)
@@ -698,6 +734,7 @@ class _rml_flowable(object):
from reportlab.graphics.barcode import fourstate
from reportlab.graphics.barcode import usps
except Exception, e:
+ self._logger.warning("Cannot use barcode renderers:", exc_info=True)
return None
args = utils.attr_get(node, [], {'ratio':'float','xdim':'unit','height':'unit','checksum':'int','quiet':'int','width':'unit','stop':'bool','bearers':'int','barWidth':'float','barHeight':'float'})
codes = {
@@ -739,38 +776,29 @@ class _rml_flowable(object):
style = styles['Heading'+str(node.tag[1:])]
return platypus.Paragraph(self._textual(node), style, **(utils.attr_get(node, [], {'bulletText':'str'})))
elif node.tag=='image':
+ image_data = False
if not node.get('file'):
if node.get('name'):
- image_data = self.doc.images[node.get('name')].read()
+ if node.get('name') in self.doc.images:
+ self._logger.debug("Image %s read ", node.get('name'))
+ image_data = self.doc.images[node.get('name')].read()
+ else:
+ self._logger.warning("Image %s not defined", node.get('name'))
+ return False
else:
import base64
if self.localcontext:
newtext = utils._process_text(self, node.text or '')
node.text = newtext
image_data = base64.decodestring(node.text)
- if not image_data: return False
+ if not image_data:
+ self._logger.debug("No inline image data")
+ return False
image = StringIO(image_data)
- return platypus.Image(image, mask=(250,255,250,255,250,255), **(utils.attr_get(node, ['width','height'])))
else:
- return platypus.Image(node.get('file'), mask=(250,255,250,255,250,255), **(utils.attr_get(node, ['width','height'])))
- from reportlab.lib.utils import ImageReader
- name = str(node.get('file'))
- img = ImageReader(name)
- (sx,sy) = img.getSize()
- args = {}
- for tag in ('width','height'):
- if node.get(tag):
- args[tag] = utils.unit_get(node.get(tag))
- if ('width' in args) and (not 'height' in args):
- args['height'] = sy * args['width'] / sx
- elif ('height' in args) and (not 'width' in args):
- args['width'] = sx * args['height'] / sy
- elif ('width' in args) and ('height' in args):
- if (float(args['width'])/args['height'])>(float(sx)>sy):
- args['width'] = sx * args['height'] / sy
- else:
- args['height'] = sy * args['width'] / sx
- return platypus.Image(name, mask=(250,255,250,255,250,255), **args)
+ self._logger.debug("Image get from file %s", node.get('file'))
+ image = _open_image(node.get('file'), path=self.doc.path)
+ return platypus.Image(image, mask=(250,255,250,255,250,255), **(utils.attr_get(node, ['width','height'])))
elif node.tag=='spacer':
if node.get('width'):
width = utils.unit_get(node.get('width'))
From ee07fda232284e0a57db225882d3acf70f17aa61 Mon Sep 17 00:00:00 2001
From: "P. Christeas"
Date: Fri, 3 Dec 2010 18:46:06 +0200
Subject: [PATCH 06/42] ir.values: do return the search_view_id of action
windows [Bug 681479]
Partially revert cadc172a2cd09, that prevented both that field and
"search_view" from being read. While the latter one is expensive to
compute, the "search_view_id" is pretty harmless. GTK client (at least)
depends on that to select the appropriate search view.
bzr revid: p_christ@hol.gr-20101203164606-qdjfg0o7ybe0h2i1
---
bin/addons/base/ir/ir_values.py | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/bin/addons/base/ir/ir_values.py b/bin/addons/base/ir/ir_values.py
index 602e2a10a80..babd98de282 100644
--- a/bin/addons/base/ir/ir_values.py
+++ b/bin/addons/base/ir/ir_values.py
@@ -26,8 +26,7 @@ from tools.translate import _
EXCLUDED_FIELDS = set((
'report_sxw_content', 'report_rml_content', 'report_sxw', 'report_rml',
- 'report_sxw_content_data', 'report_rml_content_data', 'search_view',
- 'search_view_id'))
+ 'report_sxw_content_data', 'report_rml_content_data', 'search_view', ))
class ir_values(osv.osv):
_name = 'ir.values'
@@ -205,6 +204,12 @@ class ir_values(osv.osv):
datas = datas and datas[0]
if not datas:
return False
+ if model == 'ir.actions.act_window' \
+ and 'search_view_id' in datas \
+ and datas['search_view_id']:
+ # GTK client has a bug, where it expects only the integer id
+ # rather than [id, name] (of many2one fields)
+ datas['search_view_id'] = datas['search_view_id'][0]
else:
datas = pickle.loads(x[2].encode('utf-8'))
if meta:
From d5910dcfc98ecdfd202656c7715d13d72c1ca507 Mon Sep 17 00:00:00 2001
From: "psi (Open ERP)"
Date: Mon, 6 Dec 2010 12:43:42 +0530
Subject: [PATCH 07/42] [IMP] account: Add menu partners
bzr revid: psi@tinyerp.co.in-20101206071342-mxfvdqh4ka1kgkt4
---
addons/account/account_menuitem.xml | 17 +++++++++--------
addons/account/account_view.xml | 14 ++++++++++++++
addons/account/board_account_view.xml | 2 +-
addons/account_budget/account_budget_view.xml | 2 +-
addons/account_payment/account_payment_view.xml | 2 +-
.../voucher_payment_receipt_view.xml | 8 ++++----
.../voucher_sales_purchase_view.xml | 4 +++-
7 files changed, 33 insertions(+), 16 deletions(-)
diff --git a/addons/account/account_menuitem.xml b/addons/account/account_menuitem.xml
index 4094b453ab7..05795c2f380 100644
--- a/addons/account/account_menuitem.xml
+++ b/addons/account/account_menuitem.xml
@@ -4,22 +4,23 @@
-
-
-
+
+
+
-
+
-
-
+
+
-
+
@@ -27,7 +28,7 @@
-
+
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index f2b4da6ea23..f777f4aa448 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -2745,5 +2745,19 @@ action = self.pool.get('res.config').next(cr, uid, [], context)
+
+ Partners
+ ir.actions.act_window
+ res.partner
+ form
+
+
+
+
+
diff --git a/addons/account/board_account_view.xml b/addons/account/board_account_view.xml
index bcedc3fa491..93bcc7724be 100644
--- a/addons/account/board_account_view.xml
+++ b/addons/account/board_account_view.xml
@@ -68,7 +68,7 @@
-
+
diff --git a/addons/account_budget/account_budget_view.xml b/addons/account_budget/account_budget_view.xml
index 3915463d8a2..6cdadda2338 100644
--- a/addons/account_budget/account_budget_view.xml
+++ b/addons/account_budget/account_budget_view.xml
@@ -45,7 +45,7 @@
-
+
diff --git a/addons/account_payment/account_payment_view.xml b/addons/account_payment/account_payment_view.xml
index d0543d72242..8966a6c88ac 100644
--- a/addons/account_payment/account_payment_view.xml
+++ b/addons/account_payment/account_payment_view.xml
@@ -39,7 +39,7 @@
-
+
payment.mode.search
diff --git a/addons/account_voucher/voucher_payment_receipt_view.xml b/addons/account_voucher/voucher_payment_receipt_view.xml
index 439e81988b8..3a0dbf40f4d 100644
--- a/addons/account_voucher/voucher_payment_receipt_view.xml
+++ b/addons/account_voucher/voucher_payment_receipt_view.xml
@@ -88,7 +88,7 @@