[IMP] stock: set putaway location on sml

This commit adds a check to avoid forcing a write on the sml
even if the putway location is the same on the sml, which
avoids unnecessary additional costly _gather() calls during the quant updates in the write

Taskid: 3090913
Part-of: odoo/odoo#106006
This commit is contained in:
Ahmed Khalaf
2023-03-07 10:06:00 +01:00
parent a16361f96d
commit a19c29c6fd
+3 -1
View File
@@ -251,9 +251,11 @@ class StockMoveLine(models.Model):
else:
for sml in smls:
qty = max(sml.reserved_uom_qty, sml.qty_done)
sml.location_dest_id = sml.move_id.location_dest_id.with_context(exclude_sml_ids=excluded_smls.ids)._get_putaway_strategy(
putaway_loc_id = sml.move_id.location_dest_id.with_context(exclude_sml_ids=excluded_smls.ids)._get_putaway_strategy(
sml.product_id, quantity=qty, packaging=sml.move_id.product_packaging_id,
)
if putaway_loc_id != sml.location_dest_id:
sml.location_dest_id = putaway_loc_id
excluded_smls -= sml
def _get_default_dest_location(self):