Odoo Help


Controller inheritance additional values

on 5/8/15, 8:33 AM 1,174 views


I wrote this code and ask me how to push the value_to_page variable to the QWeb-Template,

that is renderd in the shop function?

In QWeb i need something like <t t-esc="value_to_page" />.

import openerp
from openerp.http import route
from openerp.http import request

class SiteCategories(openerp.addons.website_sale.controllers.main.website_sale):

def shop(self):
value_to_page = "TEST VALUE"
sup = super(SiteCategories, self).shop()
return sup

Thank you

On 7/20/15, 3:43 AM

I found a solution for myself:

def shop(self):
value_to_page = "TEST VALUE"
sup = super(SiteCategories, self).shop()
sup.qcontext["value_to_page"] = value_to_page
return sup

Thank you

Nice solution. It always bothers me that website_sale controller doesn't use separated functions to build the values dict (it does that way only for checkout page), that would be easier to add values by overloading.

David Bertha
on 7/20/15, 4:29 AM

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


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)


Asked: 5/8/15, 8:33 AM
Seen: 1174 times
Last updated: 2/24/16, 9:01 AM