Use sale report as example for report replacement
The invoice report example does not work because it is managed by a wizard. issue6054 review25821002
This commit is contained in:
1 parent
221826ebb8
commit
f057bfd68f
1 file changed
+20
-10
@@ -178,35 +178,45 @@ Replacing existing Tryton reports
|
||||
To replace an existing report you must deactivate the old report and activate
|
||||
the new report.
|
||||
|
||||
For example to deactivate the invoice report:
|
||||
For example to deactivate the sale report:
|
||||
|
||||
.. highlight:: xml
|
||||
|
||||
::
|
||||
|
||||
<record model="ir.action.report" id="account_invoice.report_invoice">
|
||||
<record model="ir.action.report" id="sale.report_sale">
|
||||
<field name="active" eval="False"/>
|
||||
</record>
|
||||
|
||||
Then you must activate the new invoice report that exists in your new module:
|
||||
Then you must activate the new sale report that exists in your new module:
|
||||
|
||||
.. highlight:: xml
|
||||
|
||||
::
|
||||
|
||||
<record model="ir.action.report" id="report_invoice_new">
|
||||
<field name="name">Invoice</field>
|
||||
<field name="report_name">account.invoice</field>
|
||||
<field name="model">account.invoice</field>
|
||||
<field name="report">my_module/invoice.odt</field>
|
||||
<record model="ir.action.report" id="report_sale">
|
||||
<field name="name">Sale</field>
|
||||
<field name="report_name">sale.sale</field>
|
||||
<field name="model">sale.sale</field>
|
||||
<field name="report">my_module/sale.odt</field>
|
||||
<field name="template_extension">odt</field>
|
||||
</record>
|
||||
|
||||
And create the keyword for the new report:
|
||||
|
||||
.. highlight:: xml
|
||||
|
||||
::
|
||||
|
||||
<record model="ir.action.keyword" id="report_sale_keyword">
|
||||
<field name="keyword">form_print</field>
|
||||
<field name="model">sale.sale,-1</field>
|
||||
<field name="action" ref="report_sale"/>
|
||||
</record>
|
||||
|
||||
Passing custom data to a report
|
||||
-------------------------------
|
||||
|
||||
TODO: Examples of overriding Report.execute.
|
||||
|
||||
In this example `Report.get_context` is overridden and an employee
|
||||
object is set into context. Now the invoice report will be able to access the
|
||||
employee object.
|
||||
|
||||
Reference in new issue
Block a user