Odoo Help

0

Inject data/variables into website controller

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

Hello,

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

--

Bonjour,

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) ?

Merci

0
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)

About This Community

This platform 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.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

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