コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
6612 ビュー

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

アバター
破棄
著作者 最善の回答

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.

関連投稿 返信 ビュー 活動
1
12月 21
4940
3
5月 21
13973
2
7月 16
7988
2
8月 20
10984
1
6月 25
2251