Have you ever wondered how to create multiple layouts/reports in OpenERP7? We spent a lot of time figuring out how to do this.
Let us share our experience as a simple how to.
What you need to do is:
Note: This documentation is based on OpenERP7 version openerp-7.0-20130618-231044.
Some more details about the previous mentioned points.
cd /opt/openerp/server/openerp/addons/sale/report
cp sale_order.rml sale_order_other_layout.rml
cp sale_order.sxw sale_order_other_layout.sxw
cp sale_order.py sale_order_other_layout.py
differences after editing the file sale_order_other_layout.py:
diff sale_order.py sale_order_other_layout.py
output:
42c42
report_sxw.report_sxw('report.sale.order', 'sale.order', 'addons/sale/report/sale_order.rml', parser=order, header="external")
---
report_sxw.report_sxw('report.sale.order.other.layout', 'sale.order', 'addons/sale/report/sale_order_other_layout.rml', parser=order, header="external")
Additionally you'll have to add the newly created python file to the python package configuration (otherwise it won't be read/handled during the OpenERP application server restart):
echo "import sale_order_other_layout" >> __init__.py
Finally you'll need to restart the OpenERP application to make the new report available to the system.
/etc/init.d/openerp-server stop
/etc/init.d/openerp-server start
Before you start to adjust settings make sure that you have administration privileges and in user "Access Rights" you have "Technical Features" checked. If this is accomplished:
Parameters to set:
Finally hit the "Save" button.
Parameters to set:
Finally hit the "Save" button.
If all settings were successfully done you should have the option to choose between different sale order layouts/reports when printing (see image below!)
Please have a detailed look to the "orange"-colored annotations.
The "dummy text" is used for testing purposes only!
Finally the new layouts can be used by choosing the appropriate layout when printing the sale order.
Example reports based on the previous settings: common layout (report name: "Quotation / Order"):
other layout (report name: "Quotation / Order / Other_Layout"):
Great! Isn't it?
If you have questions or if you need professional services or support for your OpenERP/odoo installation feel free to contact us. Simply use our contact form.
VERY USEFUL - BY JORGE SIXTO
Perfect, I followed the instructions and it has worked perfect. It is very useful when I use a report for an invoice with logo for emailing and another bill that is printed with a sheet of paper with pre-printed logo for example.
Keep in mind that if a language other than English is used there to perform translations for the new report.
Thank you very much Dragan.
TRANSLATION OF CUSTOM REPORTS - BY DAVY VANDEKERCKHOVE
To have the same translations as the original report, you can copy all translations using the following steps :