Added helper for company logo

bzr revid: nicolas.vanhoren@openerp.com-20130225160650-o4llg0bg7xxt7dnp
This commit is contained in:
niv-openerp 2013-02-25 17:06:50 +01:00
parent 1d502dff1a
commit 2277598f1c
2 changed files with 9 additions and 1 deletions

View File

@ -55,7 +55,7 @@
<body style="border:0; margin: 0;" onload="subst()">
<table class="header" style="border-bottom: 0px solid black; width: 100%">
<tr>
<td>${helper.embed_logo_by_name('camptocamp_logo')|n}</td>
<td>${helper.embed_company_logo()|n}</td>
<td style="text-align:right"> </td>
</tr>
<tr>

View File

@ -39,6 +39,7 @@ class WebKitHelper(object):
self.uid = uid
self.pool = pooler.get_pool(self.cursor.dbname)
self.report_id = report_id
self.context = context
def embed_image(self, type, img, width=0, height=0) :
"Transform a DB image into an embedded HTML image"
@ -79,6 +80,13 @@ class WebKitHelper(object):
"""Return HTML embedded logo by name"""
img, type = self.get_logo_by_name(name)
return self.embed_image(type, img, width, height)
def embed_company_logo(self, width=0, height=0):
cr, uid, context = self.cursor, self.uid, self.context
my_user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
logo = my_user.company_id.logo_web
return self.embed_image("png", logo, width, height)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: