Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to add a user defined header in a rml report in openerp?

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?

like image 448
OmaL Avatar asked Dec 07 '22 12:12

OmaL


2 Answers

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.

like image 67
Atul Arvind Avatar answered Jan 13 '23 13:01

Atul Arvind


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.

like image 40
Don Kirkby Avatar answered Jan 13 '23 15:01

Don Kirkby