2016-08-18 66 views
0

我試圖使用自定義模塊中的賬戶的常見報告添加按鈕「打印XLS」,我可以能夠直接在account_report_common_view.xml如下添加按鈕,在帳戶共同使用報告自定義模塊添加按鈕 - Odoo

<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

要創建模塊,您可以按照本指南: https://www.odoo.com/documentation/9.0/howtos/backend.html

要修改,你可以繼承它的視圖,並添加,爲istance,一個鈕。 這是一個新的記錄中,模型=「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"> 

請確保您有添加您的看法你的模塊的目錄(典型視圖/ account_report_common_view_button.xml) 內,並將其添加到清單 數據:[ 「觀看/ account_report_common_view_button.xml」, ]

安德烈

相關問題