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

in controller we use --> request.render() method to render qweb template but this isn't working in model how can i render qweb template throug model ??

아바타
취소
베스트 답변

Hi, here you have a snippet of code that works for me:


def _qweb_render(self, o=None):

    val = {

        'docs': o,

        'doc_model': 'motor.record',

        'doc_ids': [o.id],

    }

    html = self.pool["ir.ui.view"].render(self.env.cr, self.env.uid, 'yourmodule.your_view_xml_id, val, engine='ir.qweb', context=self.env.context).decode('utf8')

    return HTMLSafe(html)

아바타
취소
관련 게시물 답글 화면 활동
3
9월 17
8867
1
7월 25
2075
1
5월 25
2306
1
4월 25
2558
1
2월 25
1850