[FIX] models: remove set iteration

A set iteration was creating a random number of queries on some tests.
This was noticed in TestEventPerformance were a random additionnal query
 could appear in default_get depending on _get_description and
_get_default_stage_id order.

This commit uses a list to get a deterministic order. It looks like
the set was not useful anyway.

closes odoo/odoo#113563

X-original-commit: 13572df256ccc6351588851d385c381ace155e0d
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
This commit is contained in:
Xavier-Do
2023-02-24 11:11:37 +01:00
parent 9374a6f2b7
commit 723c0c24f6
+3 -3
View File
@@ -1634,16 +1634,16 @@ class BaseModel(metaclass=MetaModel):
return False
# compute missing fields
missing_defaults = {
missing_defaults = [
name
for name, field in self._fields.items()
if name not in values
if not avoid(field)
}
]
if missing_defaults:
# override defaults with the provided values, never allow the other way around
defaults = self.default_get(list(missing_defaults))
defaults = self.default_get(missing_defaults)
for name, value in defaults.items():
if self._fields[name].type == 'many2many' and value and isinstance(value[0], int):
# convert a list of ids into a list of commands