Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
9272 Lượt xem

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>

Ảnh đại diện
Huỷ bỏ

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 ...

Câu trả lời hay nhất

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.

Ảnh đại diện
Huỷ bỏ
Tác giả

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

That's great, Enjoy odooing..

Bài viết liên quan Trả lời Lượt xem Hoạt động
3
thg 9 19
7365
3
thg 8 20
11397
4
thg 2 25
2338
1
thg 8 24
1978
2
thg 11 24
3158