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

How to create reports in odoo i know,

but how to load a template from a file (/home/templates/template.xml) and then transfer it to a report?

아바타
취소
베스트 답변

Hi Gleb,

i think you want to generate report from background (python side) or from other model/resource.

you can do like this:

                # render report and get as pdf

                REPORT_ID = 'moduleName.template_id' # template id (that you have to find from report template)

                pdf = self.env.ref(REPORT_ID).render_qweb_pdf(record_id) # Give record id to generate for

                b64_pdf = base64.b64encode(pdf[0])

Now you will get pdf in b64_pdf so you can set this as attachment or send as email whatever you want 
 

https://goo.gl/TqYCYX


don't forget to accept answer if helpful.

thank you

아바타
취소
베스트 답변

f you mean that "/home" is a module directory,, then you just can call template by <t t-call="home.template_xml_id" />


Regards

아바타
취소
관련 게시물 답글 화면 활동
QWeb report 해결 완료
1
1월 19
4036
2
4월 25
6442
0
9월 22
4111
0
3월 22
6985
2
8월 25
650