Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
2131 มุมมอง

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


อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
ก.ค. 24
2118
4
ต.ค. 20
5204
1
มี.ค. 15
4957
1
เม.ย. 24
31477
Close wizard after print report แก้ไขแล้ว
3
ก.พ. 24
12288