Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
1 Beantwoorden
6544 Weergaven

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

Avatar
Annuleer
Auteur Beste antwoord

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

Avatar
Annuleer

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.

Gerelateerde posts Antwoorden Weergaven Activiteit
1
dec. 21
4868
3
mei 21
13919
2
jul. 16
7923
2
aug. 20
10906
1
jun. 25
2135