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

I want to add a button in a form view, the action of this is to print the report. How can I do this? it seems like printing report in Odoo 12 is far different from Odoo10. can someone have the tutorial for this scenario? Thanks :)

Ảnh đại diện
Huỷ bỏ

Thanks Niyas and Sudhir

Câu trả lời hay nhất

Hi,

Check the code of the print button added in the sale order form.


See a sample below:

return self.env.ref('test.test_report').report_action(record_id)

in the below image you can see the code of the print button in the sale order form.


Thanks

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

As Niyas said, you can get the reference from the core modules like Sales, Purchase.

Ex:

return self.env.ref('module_name.XML_ID_of_report').report_action(self)


Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
3
thg 10 23
8769
1
thg 9 23
3317
1
thg 5 23
2253
2
thg 4 23
2808
1
thg 3 23
2186