Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
2843 Lượt xem

I want to create a pdf report but this xml file cause me error 

raise ParseError('while parsing %s:%s, somewhere inside\n%s' % (
Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/aadil/src/odoo/odoo/http.py", line 643, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/home/aadil/src/odoo/odoo/http.py", line 301, in _handle_exception
raise exception.with_traceback(None) from new_cause
odoo\\.tools\\.convert\\.ParseError:\\ while\\ parsing\\ /home/aadil/src/custom/test_school/report/student_report\\.xml:3,\\ somewhere\\ inside
"\ rel="ugc">ir\.actions\.report">
\ Student\ Record\
test\.student
qweb\.pdf
student_record\.personal
student_record\.personal
student_record\.personal

report


Error\ ScreenShot\ Link\ \(if\ not\ properly\ pasted\) https://imgur.com/a/1yKqE7k

Kindly help me what is wrong.. I am following YT video.. If someone can refer me some tutorial as I am beginner to odoo

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,

It looks like the issue might be with how the report action is defined in your XML. Here's a basic example of how a report action should look:

xml

<record id="action_for_report" model="ir.actions.report"> <field name="name">Name Of The Report</field> <field name="model">sale.order</field> <field name="report_type">qweb-pdf</field> <field name="report_file">custom_module_name.template_id</field> <field name="report_name">custom_module_name.template_id</field> <field name="binding_model_id" ref="sale.model_sale_order"/> <field name="binding_type">report</field> </record>

Here are a couple of things to keep in mind:

  • The model field should match the technical name of the model you're reporting on (e.g., sale.order).
  • If you want the report to be accessible via the Print button on the model's form view, you need to set the binding_model_id accordingly. For example, for sale.order, the reference should be sale.model_sale_order.

I recommend checking out this tutorial on creating a PDF report in Odoo 15. It explains everything step-by-step:

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


Hope it helps

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 2 24
3831
1
thg 7 23
2051
1
thg 5 24
2307
1
thg 4 24
1962
0
thg 4 24
1715