Construct move key for assignation by converting list to tuple

Instead of creating a new tuple on each field, it is faster to fill a list and
convert it to a tuple at the end.
This commit is contained in:
Cédric Krier
2025-10-03 16:41:12 +02:00
parent 5188badcfc
commit 1c71eaba67
+3 -3
View File
@@ -1166,13 +1166,13 @@ class Move(Workflow, ModelSQL, ModelView):
grouping_filter=(product_ids,))
def get_key(move, location_id):
key = (location_id,)
key = [location_id]
for field in grouping:
value = getattr(move, field)
if isinstance(value, Model):
value = value.id
key += (value,)
return key
key.append(value)
return tuple(key)
def get_values(key, location_name):
yield location_name, key[0]