summaryrefslogtreecommitdiff
path: root/addons/web/controllers/main.py
diff options
context:
space:
mode:
authorDenis Ledoux <dle@odoo.com>2018-01-11 15:13:28 +0100
committerDenis Ledoux <dle@odoo.com>2018-01-11 15:48:08 +0100
commit78d0a32470794104f0f6ff4f2ae84d318147df24 (patch)
tree457140bf14d3df87d622305322b57a2a44827d03 /addons/web/controllers/main.py
parentbc1c72f9afe80b4cecace5f9672484aee978096d (diff)
[FIX] web: force a determinist installed modules order for the assets
The backend assets includes a list of the installed modules with: ``` odoo._modules = <t t-raw="get_modules_order()"/>; ``` 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
Diffstat (limited to 'addons/web/controllers/main.py')
-rw-r--r--addons/web/controllers/main.py7
1 files 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