Odoo Help

Welcome!

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.

2

Controller inheritance additional values

By
Andre
on 5/8/15, 8:33 AM 1,097 views

Hi,

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

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

Thank you

4
Andre
On 7/20/15, 3:43 AM

I found a solution for myself:

...
@route()
def shop(self):
value_to_page = "TEST VALUE"
sup = super(SiteCategories, self).shop()
#MY SOLUTION START
sup.qcontext["value_to_page"] = value_to_page
#MY SOLUTION END
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)

Stats

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