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.


Controller inheritance additional values

on 5/8/15, 8:33 AM 960 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 community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)


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