[FIX] base: Correct server version when assets change

Before this commit, the server version used to detect whether the client
assets are outdated relied on the `odoo.release.version` string directly
imported at the root of the `assetsbundle.py` file.

The problem is that this string is altered by web_enterprise and we must
wait for these changes before using the string.

This commit dynamically imports the `release.version` string to use its
final version.

closes odoo/odoo#82705

X-original-commit: 9eccbd884853fddab8a17d28779d670e7d48bbc3
Signed-off-by: Olivier Dony <odo@odoo.com>
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
This commit is contained in:
Julien Mougenot
2022-01-13 16:26:40 +00:00
parent 08be3aef88
commit 95e075ea28
+2 -3
View File
@@ -20,13 +20,12 @@ except ImportError:
# `sassc` executable in the path.
libsass = None
from odoo import SUPERUSER_ID
from odoo import release, SUPERUSER_ID
from odoo.http import request
from odoo.modules.module import get_resource_path
from odoo.tools import func, misc, transpile_javascript, is_odoo_module, SourceMapGenerator, profiler
from odoo.tools.misc import file_open, html_escape as escape
from odoo.tools.pycompat import to_text
from odoo.release import version as server_version
_logger = logging.getLogger(__name__)
@@ -344,7 +343,7 @@ class AssetsBundle(object):
# to invite the user to refresh their browser
if self.env and 'bus.bus' in self.env and self.name in self.TRACKED_BUNDLES:
self.env['bus.bus']._sendone('broadcast', 'bundle_changed', {
'server_version': server_version
'server_version': release.version # Needs to be dynamically imported
})
_logger.debug('Asset Changed: bundle: %s -- version: %s', self.name, self.version)