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

I want to build a mini markup mechanism for PDF reports. How can I use regular expression in Qweb report to change the output?

I want to create a bold text string from * * a bold text string * *

For that I use

Bacon Burger

in my template. In my model (wich I inherit from sale.order) I define a method 

def minimarkupmagic(self,txt):
​txt = re.sub(r'\*{2,2}(.*?)\*{2,2}', r'\1', txt)
​txt = re.sub(r'_{2,2}(.*?)_{2,2}', r'\1', txt)
​txtArr = txt.split('\n')
​txt = '
'.join(txtArr)
​return txt

and send it to my template within 

docargs = {
...,
​'minimarkupmagic': self.minimarkupmagic
}

from def render_html().

It works half way: I only get an output like

in my report, so it seems that the method runs after the rendering of the HTML to PDF.


So how could I get my HTML get interpreted earlier and get my correct output?

Thnx!

EDIT: I just found the answer: I found out that it works if you use t-raw. I used t-esc... :-)

아바타
취소
관련 게시물 답글 화면 활동
1
2월 22
2740
2
8월 25
1087
1
11월 24
12747
0
8월 24
17
0
1월 24
1931