Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Inject data/variables into website controller

Jérémy Hermand
on 3/27/15, 6:49 AM 596 views


In my website I would like to have a customer list above my footer. I'd like a dynamic list.

How I can inject my customers for every website controller ?

Thank you



J'aimerais sur mon site internet rajouter la liste des clients au dessus du footer.

Pour se faire il faudrait que je rajoute aux controlleurs du site web cette liste, comment je peux faire pour rajouter des variables aux controllers (sorte de variables globales) ?


Jérémy Hermand
On 3/28/15, 6:52 AM

I have founded a solution for inject data in view, is it a good solution ?

# -*- coding: utf-8 -*-

from openerp import SUPERUSER_ID
from openerp.http import request
from openerp.osv import osv, fields

class view(osv.osv):
_inherit = "ir.ui.view"

def render(self, cr, uid, id_or_xml_id, values=None, engine='ir.qweb', context=None):
if request and getattr(request, 'website_enabled', False):
if values == None:
values = {}
              values['test'] = 'data to inject'

return super(view, self).render(cr, uid, id_or_xml_id, values=values, engine=engine, context=context)

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)


Asked: 3/27/15, 6:49 AM
Seen: 596 times
Last updated: 3/28/15, 6:52 AM