From 723c0c24f64951013024c0e41cb3018a90bec6ee Mon Sep 17 00:00:00 2001 From: Xavier-Do Date: Thu, 23 Feb 2023 14:45:17 +0000 Subject: [PATCH] [FIX] models: remove set iteration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) Signed-off-by: Xavier Dollé (xdo) --- odoo/models.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/odoo/models.py b/odoo/models.py index ee04429ed95..66dbb6bef98 100644 --- a/odoo/models.py +++ b/odoo/models.py @@ -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