This question has been flagged
1 Reply
4615 Views

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