I need to show a string in the header of several reports which must change depending on the report which is being printed.
By now, I had done this:
<template id="external_layout_header" inherit_id="report.external_layout_header">
...
<t t-if="o._table=='sale_order'">
... Print here what I need to show in sale order reports ...
</t>
...
</template>
It worked well for me, but now, the string does not depend on the model/table, but on the printed report.
I have a model which has two different reports to print. If one is printed, I have to show 'X' in the header, if the other one is printed, I have to show 'Y' in the header. There is no difference between them, I mean, there is no attribute in the model which allows me identify them.
For example, in a previous case, despite having the same model, I was able to show the correct string due to the state
field value:
<template id="external_layout_header" inherit_id="report.external_layout_header">
...
<t t-if="o._table=='sale_order'">
<t t-if="o.state=='draft'">
... Print Sale Quotation ...
</t>
<t t-if="o.state!='draft'">
... Print Sale Order ...
</t>
</t>
...
</template>
But in this case there is no field which helps me. Only the report name, so I need to get it from the header.
Does anyone know how to achieve this?
render_html()
you probably need to override it, to updatedocargs
with your report as an object. – CZoellner