1
votes

Is there a module or a way to define the font size of qweb report dynamically for example on the configuration without change it on the code?

1
As far as I know, what you can change is the font type in Settings> Reports> Font, but I think it is not possible to change the size, at least not from the settings.Dayana

1 Answers

1
votes

You can create a field (or fields) on the res.company module to define font_size or any other features you want and then call them from QWeb this:

# Field can be Integer or Float
<p t-attf-style="font-size: #{o.company_id and o.company_id.font_size or '12'}px;">

# Field can be Char, but is more prone to possible user input error
<p t-attf-style="font-size: #{o.company_id and o.company_id.font_size or '12px'};">

Of course, this requires that whatever model your report is for must have a company_id field to pull from. However, most models have this already, so it is a fairly safe assumption.

This technique isn't really noted anywhere in the documentation, but I'll link to it anyway.

Qweb Documentation

Reports Documentation