我试图使用自定义模块在Account的普通报表中添加按钮"Print“,我可以在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>现在,我想在自定义模块中这样做。如何在新的自定义模块中添加此按钮?
发布于 2017-07-14 10:07:14
要创建一个模块,您可以遵循以下指南:https://www.odoo.com/documentation/9.0/howtos/backend.html
要修改一个视图,您可以继承它,并为istance添加一个botton。这是一个新记录,model="ir.ui.view":
<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"> 确保在模块的目录中添加了视图(典型的视图/帐户_报告_公共_视图_按钮),并将其添加到清单数据中:“view /account_report_ inside _view_Buon.xml”,
安德里亚
https://stackoverflow.com/questions/39018489
复制相似问题