Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Custom pdf template layout

By
Romain E Silva
on 12/11/15, 6:39 AM 475 views

Hi,


First of all I'm on Odoo 8, I would like to add odoo8 tag but it seems that there has an issue with CORS for the ajax request of tags.

For some module of mines I want to include some custom css files in the printed layout. To achieve this I've made a custom report_layout and used it in my reports, with this I can easily edit header in the assets per submodule.

It's good for HTML report, but when it come to pdf the nightmare begin. As I've seen, the pdf action use another layout that can't be easily override :

 https://github.com/odoo/odoo/blob/8.0/addons/report/models/report.py#L216

render_minimal = partial(view_obj.render, cr, ui, 'report.minimal_layout', context=context)

 

The report.minimal_layout call a report.assets_pdf that include a style, I've tried to override this template but there is two problems with that :
- The first one is that it does nothing as if the override does not exist (probably a mistake of mine)

- The second one is that the modification will apply to all reports and that's not what I want


Is there a proper way to add custom css in pdf for some report only ? Note that I don't wan't to use inline style. I personnaly think that it could be fine to customize which layout need to be used for a pdf report as we can decide it for html report.


Thanks in advance

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 12/11/15, 6:39 AM
Seen: 475 times
Last updated: 12/11/15, 7:00 AM