Skip to Content
Menu
This question has been flagged
1 Reply
3471 Views

I have this block in a deliveryslip qweb report. It shows the product description instead of the product id. This just works if the delivery isn't in state done.

                   <table class="table table-sm mt48" t-if="o.state!='done'">
<thead>
<tr>
<th><strong>Product</strong></th>
<th><strong>Quantity</strong></th>
</tr>
</thead>
<tbody>
<t t-set="lines" t-value="o.move_lines.filtered(lambda x: x.product_uom_qty)"/>
<tr t-foreach="lines" t-as="move">
<td>
<span t-field="move.name"/>
<p t-if="o.picking_type_code == 'outgoing'">
<span t-field="move.product_id.sudo().description_pickingout"/>
</p>
<p t-if="o.picking_type_code == 'incoming'">
<span t-field="move.product_id.sudo().description_pickingin"/>
</p>
</td>
<td>
<span t-field="move.product_uom_qty"/>
<span t-field="move.product_uom"/>
</td>
</tr>
</tbody>
</table>

I want just to add the same function; show the product decription if the state is done. Here the code.

​<table class="table table-sm mt48" t-if="o.move_line_ids and o.state=='done'">
<t t-set="has_serial_number" t-value="o.move_line_ids.mapped('lot_id')"/>
<thead>
<tr>
<th><strong>Product</strong></th>
<th name="lot_serial" t-if="has_serial_number" groups="stock.group_lot_on_delivery_slip">
Lot/Serial Number
</th>
<th class="text-center"><strong>Quantity</strong></th>
</tr>
</thead>
<tbody>
<tr t-foreach="o.move_line_ids" t-as="move_line">
<td>
<span t-field="move_line.product_id"/>
<p t-if="o.picking_type_code == 'outgoing'">
<span t-field="move_line.product_id.sudo().description_pickingout"/>
</p>
<p t-if="o.picking_type_code == 'incoming'">
<span t-field="move_line.product_id.sudo().description_pickingin"/>
</p>
</td>
<td t-if="has_serial_number and move_line.lot_name" groups="stock.group_lot_on_delivery_slip">
<span t-field="move_line.lot_name"/>
</td>
<td t-else="" groups="stock.group_lot_on_delivery_slip">
<span t-field="move_line.lot_id.name"/>
</td>
<td class="text-center">
<span t-field="move_line.qty_done"/>
<span t-field="move_line.product_uom_id"/>
</td>
</tr>
</tbody>
</table>

The QWEB format is de default one:  stock.report_delivery_document

Avatar
Discard
Best Answer

you need inherit the template report first then customize it

    <template id="custom_report_delivery_document" name="custom_report_delivery_document" inherit_id="stock.report_delivery_document ">

        <xpath expr="//table[index_table_that_you_want_customized]" position="replace">

            #your_statement

        </xpath>

    </template>

Avatar
Discard
Author

I actually tried that. I don't know how to make it work.

did you call your xml file in your module manifest?

Author

Of course, the problem is that when I substitude product_id for the name it just doens't show like in the first one.

yes yes i know the problem but i doubt you will understand if i explain it here maybe you can share your picture of the report template with the changes that you want to my email frayhands@gmail.com

Related Posts Replies Views Activity
2
Oct 22
4551
2
Mar 21
2509
2
Mar 21
7226
0
Dec 20
2693
0
May 20
1938