From 78d0a32470794104f0f6ff4f2ae84d318147df24 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Thu, 11 Jan 2018 15:13:28 +0100 Subject: [PATCH] [FIX] web: force a determinist installed modules order for the assets The backend assets includes a list of the installed modules with: ``` odoo._modules = ; ``` Because of the randomization of Python 3.5 in the dict keys, the order of the installed modules could change from time to time, therefore making the assets being regenerated unnecessarily This revision is a bit linked to the below one: f3bb9ae679c665b4747ed9f52d47015a5d87f120 In addition to have the dict keys always in the same order, it's important for the values to always be the same, and it was not the case for this list which was in the content of the backend assets, in various order. opw-804747 --- addons/web/controllers/main.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index a8a32347882..30b75684e05 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -24,6 +24,7 @@ import werkzeug import werkzeug.utils import werkzeug.wrappers import werkzeug.wsgi +from collections import OrderedDict from werkzeug.urls import url_decode, iri_to_uri from xml.etree import ElementTree @@ -155,10 +156,10 @@ def module_installed(environment): # TODO The following code should move to ir.module.module.list_installed_modules() Modules = environment['ir.module.module'] domain = [('state','=','installed'), ('name','in', loadable)] - modules = { - module.name: module.dependencies_id.mapped('name') + modules = OrderedDict( + (module.name, module.dependencies_id.mapped('name')) for module in Modules.search(domain) - } + ) sorted_modules = topological_sort(modules) return sorted_modules