[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:
f3bb9ae679

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
This commit is contained in:
Denis Ledoux
2018-01-11 15:48:08 +01:00
parent bc1c72f9af
commit 78d0a32470
+4 -3
View File
@@ -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