我正在尝试使用自定义模块在帐户的常见报告中添加“打印XLS”按钮,我可以直接在 account_report_common_view.xml 中添加按钮,如下所示,
<record id="account_common_report_view" model="ir.ui.view">
<field name="name">Common Report</field>
<field name="model">account.common.report</field>
<field name="arch" type="xml">
<form string="Report Options">
<field name="company_id" invisible="1"/>
<group col="4">
<field name="target_move" widget="radio"/>
<field name="date_from"/>
<field name="date_to"/>
</group>
<group col="3">
<field name="journal_ids" widget="many2many_tags" options="{'no_create': True}"/>
</group>
<footer>
<button name="check_report" string="Print" type="object" default_focus="1" class="oe_highlight"/>
or
<button name="check_report_xlsx" string="Print XLS" type="object" default_focus="1" class="oe_highlight"/> -- ADDED HERE
or
<button string="Cancel" class="oe_link" special="cancel" />
</footer>
</form>
</field>
</record>
现在我想在自定义模块中执行此操作。如何在新的自定义模块中添加此按钮?
答案 0 :(得分:0)
要创建模块,您可以按照本指南操作: https://www.odoo.com/documentation/9.0/howtos/backend.html
要修改视图,您可以继承它,并添加一个按钮。 在新记录中,model =&#34; ir.ui.view&#34;:
<record id="your_name" model="ir.ui.view">
<field name="name"> A name</field>
<field name="model">account.common.report</field>
<field name="inherit_id" ref="account.account_common_report_view"/>
<field name="arch" type="xml">
<data>
<!-- new tab added -->
<xpath expr="//notebook/page" position="after">
确保已在模块目录中添加视图(典型视图/ account_report_common_view_button.xml) 并将其添加到清单 数据:[&#34; view / account_report_common_view_button.xml&#34;, ]
安德烈