콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
6611 화면

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
4939
3
5월 21
13972
2
7월 16
7988
2
8월 20
10981
1
6월 25
2245