Friday, March 21, 2025
1 change · saas-17.4
Enhancements to existing features
Packing products in inventory transfers is now much faster when many tracked items are involved. The change avoids unnecessary background updates during packing, reducing delays for warehouse users handling large shipments or multiple packages.
Original PR description
When putting products in pack from the picking FormView `picking._put_in_pack` is eventually called. This method does a few things, amongst those is a write on picking.move_line_ids and another is…
When putting products in pack from the picking FormView `picking._put_in_pack` is eventually called. This method does a few things, amongst those is a write on picking.move_line_ids and another is the creation of a new package level. Both of these can be a bit slow when the picking's number of move_lines gets bigger. This can happen for SN tracked products for instance. In a database with 1800 move_lines, each _put_in_pack call takes around 1.5s, which can become cumbersome when customers are using multiple packages. Most of this slowness is coming from two things. The first one is stock.quants synchronization when writing on move.lines. The propose solution in this commit is to skip this synchronization when the only value in the vals dict is `result_package_id`. We can do that because this value is not used in the first quants synchronization of the write method. The second one is a write of `location_dest_id` on the picking's move_ids and move_line_ids in `package_level.create`. Since the package_level.location_dest_id value is coming from the `move_line_ids` value in `_put_in_pack`, this commit adds a context key to skip this write in case we're coming from `picking._put_in_pack` #### speedup In a 17.4 customer database, putting in pack for a picking with 1800 move_lines: 1.5s -> 90ms --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr