Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
9278 มุมมอง

I am trying to inherit Qweb Report. I am successful in inserting static values inside my qweb Report but while i tried to add some computed module it didn't shown me the values. 

<odoo>

    <data>

        <template id="delivery_order_report" inherit_id="stock.report_picking">

   

                <xpath expr="//table[@id='mytable']" position="inside">

     <tfoot>

     

     <tr>

      <td>sum</td>

      <td><t t-esc="o.pack_operation_ids.pack_lot_ids.qty for o in docs])" /></td>

     </tr>

        

     </tfoot>

    </xpath>

            

  

  </template>

    </data>

</odoo>


you can see my code my inheriting qweb report of  model named as stock.report_picking. One interesting thing while i tried to fetch o.origin it shows me successfully . below is the code 

<odoo>

    <data>

        <template id="delivery_order_report" inherit_id="stock.report_picking">

   

                <xpath expr="//table[@id='mytable']" position="inside">

     <tfoot>

     

     <tr>

      <td>sum</td>

      <td><t t-esc="o.origin" /></td>

     </tr>

        

     </tfoot>

    </xpath>

            

  

  </template>

    </data>

</odoo>

อวตาร
ละทิ้ง

i did not read your question ...

but in my case sum function help me..

for example.

t-esc="sum([o.amount_cost for o in docs])"

as per your question ...

คำตอบที่ดีที่สุด

Hi Hassan,

If you are trying to display the value of compute field which is not set as store=True, than yes you cannot display.


You have two options.

1. Either set store=True into that functional field and update methods of that functional with some decorator of  

api.depends(Fieldlist), than that function will be triggered based on the value changed, which is applied on depends list.

and you will be able to directly display that compute field.

Or.

2. Make new field, take varible on your report set with 0 value. and do sum on the fly or runtime, the example for the run time as already Usman, has mentioned in the comment of your answer.

I hope this answer will clear your view about the function field limitation on qweb.


Rgds,

Anil.

อวตาร
ละทิ้ง
ผู้เขียน

Thanks for your help . Its really helped me out . Thanks for your time.

That's great, Enjoy odooing..

Related Posts ตอบกลับ มุมมอง กิจกรรม
3
ก.ย. 19
7372
3
ส.ค. 20
11397
4
ก.พ. 25
2346
1
ส.ค. 24
1979
2
พ.ย. 24
3167