How can I add a new header/footer for a report(for example picking list report in delivery order) other than the header/ footer defined in the company?
In report tag put header='False', eg.
<report header='False' auto="False" id="report_product_history"
model="product.product" name="stock.product.history"
string="Stock Level Forecast"/>
it will not print the default header define in the company.
then in rml file find <pageTemplate>
tag, and replace it with your rml code.
eg.
<template pageSize="(595.0,842.0)" title="Test"
author="Atul Makwana" allowSplitting="20">
<pageTemplate id="first">
***Your rml header & footer***
</pageTemplate>
</template>
This way you can put new header and footer.
One way to remove the header is what Atul suggested, declare it in the report tag.
<report
header="False"
auto="False"
id="report_product_history"
model="product.product"
name="stock.product.history"
string="Stock Level Forecast"/>
In some situations there is no report tag. For example, a report might only be generated by a wizard. In that case, you can declare it as a parameter when you register the parser. See the mrp_operations
module's barcode report for an example.
class code_barcode(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(code_barcode, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
})
report_sxw.report_sxw('report.mrp.code.barcode',
'mrp_operations.operation.code',
'addons/mrp_operations/report/mrp_code_barcode.rml',
parser=code_barcode,
header=False)
You can also specify a specific header using that parameter. It defaults to 'external'
, but it can be 'internal'
or 'internal landscape'
to use one of the other headers from the company configuration.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With