In openerp render function returns the 'ir.ui.view' but embellish it with some variables/methods used in reports. param values is additional methods/variables used in the rendering returns is html representation of the template.
use this code show below in .py file,
def render(self, cr, uid, ids, template, values=None, context=None):
if values is None:
values = {}
if context is None:
context = {}
context = dict(context, inherit_branding=True) # Tell QWeb to brand the generated html
view_obj = self.pool['ir.ui.view']
user = self.pool['res.users'].browse(cr, uid, uid)
website = None
if request and hasattr(request, 'website'):
if request.website is not None:
website = request.website
context = dict(context, translatable=context.get('lang') != request.website.default_lang_code)
values.update(
time=time,
context_timestamp=lambda t: fields.datetime.context_timestamp(cr, uid, t, context),
editable=True,
user=user,
res_company=user.company_id,
website=website,
)
return view_obj.render(cr, uid, template, values, context=context)
0 Comment(s)