Skip to Content
Menu
This question has been flagged
2 Replies
9275 Zobrazenia

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>

Avatar
Zrušiť

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

Best Answer

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.

Avatar
Zrušiť
Autor

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

That's great, Enjoy odooing..

Related Posts Replies Zobrazenia Aktivita
3
sep 19
7371
3
aug 20
11397
4
feb 25
2340
1
aug 24
1979
2
nov 24
3165