2017-04-05 7 views
0

フィールドを非表示にする(Period Length (days))と同時に新しいフィールドを追加するには、account.account_aged_balance_viewを無効にする必要があります。ビューフォームを置き換える正しい方法

私はカスタムモジュールビューに次のようにしようとした:

<openerp> 
    <data> 
    <record id="account_aged_balance_view" model="ir.ui.view"> 
     <field name="name">Aged Partner Balance</field> 
     <field name="model">account.aged.trial.balance</field> 
     <field name="inherit_id" ref="account.account_aged_balance_view" /> 
     <field name="arch" type="xml"> 
      <form string="Report Options"> 
       <separator string="Aged Partner Balance"/> 
       <label string="Dariel Partner Balance is a more detailed report of your receivables by intervals. When opening that report, Odoo asks for the name of the company, the Start Date and the size of the interval to be analyzed (in days). Odoo then calculates a table of credit balance by start Date. So if you request an interval of 30 days Odoo generates an analysis of creditors for the past month, past two months, and so on. "/> 
       <group col="4"> 
        <field name="date_from"/> 
        <newline/> 
        <field name="result_selection" widget="radio"/> 
        <field name="target_move" widget="radio"/> 
       </group> 
       <field name="journal_ids" required="0" invisible="1"/> 
      </form> 
     </field> 
    </record> 
    </data> 
</openerp> 
XML

それらの画像に示されるように、代わりに原形を置き換えるのモーダルフォームに追加。 enter image description here

だから私は正しいことをしていますか(それは正しいのですか)、それを行う正しい方法は?

答えて

1

フォームビュー全体を置き換えるか、必要なフィールドのみを削除して追加することもできます。これを行うにはxpathを使用する必要があります。私はそれを試してみたが、それはなかった

<record id="account_aged_balance_view" model="ir.ui.view"> 
    <field name="name">Aged Partner Balance</field> 
    <field name="model">account.aged.trial.balance</field> 
    <field name="inherit_id" ref="account.account_aged_balance_view" /> 
    <field name="arch" type="xml"> 

     <xpath expr='//field[@name="period_length"]' position='replace'/> 

     <xpath expr='//field[@name=" < name of the field you want to put yours after > "]' position='after'> 
      <field name=' < your field name > '/> 
     </xpath> 

    </field> 
</record> 

<record id="account_aged_balance_view" model="ir.ui.view"> 
    <field name="name">Aged Partner Balance</field> 
    <field name="model">account.aged.trial.balance</field> 
    <field name="inherit_id" ref="account.account_aged_balance_view" /> 
    <field name="arch" type="xml"> 
     <xpath expr='//form' position='replace'> 

      < your form view > 

     </xpath> 
    </field> 
</record> 

それともあなたが欲しいとあなたが望むものを追加していないものだけを削除することができます全体のビューを置き換えるために

うまくいくはずです。

+0

ありがとう、魅力のような作品です –

関連する問題