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

I'm using Odoo17 and I want to print PDF Report from Wizard. The Wizard works fine, when I click on the button that trigger the function to print the PDF it download a blank PDF. To keep things simple, I'm not gonna publish all the code. So basically here are my files :


wizard/wizard_model

class ModelWizard (models.TransientModel):
   _name = 'project.pdf.report'
   _description='display printed informations'
   
   info= fields.Char()
   
   def print_report(self):
     print(self.env.context)
     data = {
           'model_id': self.id,
           'form': self.env.context
       }

     return self.env.ref('my_addon.action_report_Pdf').report_action(None, data=data)

Then I got my action file :

report/ir_actions_report

   

       My PDF

       project.pdf.report

       qweb-pdf

       my_addon.my_pdf

       my_addon.my_pdf

       'Name

       

       report

   


And finally my template:

   

       

           

               

                   

                       

Sample Report

                   

               

           

       

   


I must have missed something. When the PDF is download the file got  name instead of . And page is blank, no header nor footer.

Could you help please ?

Thanks!!


아바타
취소
베스트 답변

Hi,

Please refer to our blog below to create a PDF report from the wizard

https://www.cybrosys.com/blog/how-to-create-pdf-report-in-odoo-16 .

And if the issue in the header and footer still exists, It may be the issue in your wkhtmltopdf package so to fix it 

Please uninstall your current wkhtmltopdf package and install it again. You can use the below code

sudo wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb

sudo dpkg -i wkhtmltox_0.12.5-1.bionic_amd64.deb

sudo apt install -f

And also Please verify that all the URLs in the system parameter is same as your URL Settings -> Technical -> parameters -> system parameters


On searching URL you can see the below options. verify the URLs are same as your URL


Hope it helps

아바타
취소
작성자 베스트 답변

Merci pour votre réponse. J'ai une erreur maintenant :

odoo.addons.base.models.ir_qweb.QWebException : erreur lors du rendu du modèle

AttributeError : l'objet 'str' n'a pas d'attribut '_name'

Modèle : web.external_layout_boxed


아바타
취소
관련 게시물 답글 화면 활동
2
7월 24
3409
4
10월 20
6054
1
3월 15
5678
1
4월 24
32520
3
2월 24
13037