2017-07-13 12 views
1

レポートにカウンタを追加したい。私は、印刷ボタンをクリックするたびに、報告書は、1刷り、1刷り、2刷り、3刷りなどのように+1インクリメントで印刷する必要があります。この種の技法を解決するための考え方はありますか?それが不可能な場合、私は別のアイデアを持っていますが、私はそれを行う方法もわかりません。そしてそれは:フォームにフィールドを追加し、カスタム印刷ボタンをクリックするたびに、フィールド値が1ずつ増加します。その更新されたフィールドがレポートに印刷されます。 私はまだ学習の少年です。例で返信してください。フィールド値を1で更新するodooのカウンタボタンを追加

は私が持っていることは次のとおりです。 enter image description here

<record id="apple_view_form" model="ir.ui.view"> 
    <field name="name">Apple Form</field> 
    <field name="model">se.apple</field> 
    <field name="arch" type="xml"> 
     <form> 
      <header> 
       <button name="print_report" string="Print Apple" type="object"/> 
      </header> 
      <h1 class="dexter">This is Dexter</h1> 
      <sheet> 
       <group name="group_top"> 
        <group name="group_left"> 
         <field name="apple_name"/> 
        </group> 
        <group name="group_right"> 
         <field name="apple_price"/> 
        </group> 
       </group> 
       <group name="group_bottom"> 
        <field name="apple_description"/> 
        <field name="apple_remarks"/> 
       </group> 
       <templates id="template" xml:space="preserve"> 
        <t t-name="custom_btn"> 
         <button string="Custom Button">Custom Button</button> 
        </t> 
       </templates> 
      </sheet> 
     </form> 
    </field> 
</record> 

答えて

0

あなたが示唆したように、あなたがモデルに見えないフィールドを作ることができます。次に、printメソッドを継承し、その不可視フィールドをインクリメントします。レポートにはオブジェクト全体が用意されているので、レポートの不可視フィールドにアクセスできます。

+0

私に例を挙げることができますか –

関連する問題