Skip to Content
Menú
This question has been flagged
1 Respondre
5871 Vistes

The picking report document (stock.report_picking) has the following loop inside the table that print out the lines of the report:

 <t t-foreach="o.move_ids_without_package.sorted(key=lambda m: m.product_id.id)" t-as="move">

                                        <!-- In case you come accross duplicated lines, ask NIM or LAP -->

                                        <t t-foreach="move.move_line_ids.sorted(key=lambda ml: ml.location_id.id)" t-as="ml">


--------------------------------------------------------------------------------------------------------

How can I modify these lines of code to sort by WH location which has this area below inside the table:


<td t-if="o.picking_type_id.code != 'incoming'" groups="stock.group_stock_multi_locations">

                                                    <span t-esc="ml.location_id.display_name"/>

                                                        <t t-if="ml.package_id">

                                                            <span t-field="ml.package_id"/>

                                                        </t>

                                                </td>


I need to be able to sort the location by descending order ( https://imgur.com/pAyX8aB ) so that the highest alphabet comes on top before others. 

Thanks for your time. 

Avatar
Descartar
Best Answer

Hello,

<t t-foreach="move.move_line_ids.sorted(key=lambda ml: ml.location_id.name , reverse=True)" t-as="ml">

please try this for sort the location by descending order.

Regards,




Email:      odoo@aktivsoftware.com  

Skype: kalpeshmaheshwari

   


Avatar
Descartar
Related Posts Respostes Vistes Activitat
2
de set. 24
1833
1
d’ag. 23
2272
2
de maig 23
1769
1
de març 23
1640
2
de des. 22
5307