diff options
| author | Jeremy Kersten <jke@odoo.com> | 2018-06-21 19:11:34 +0200 |
|---|---|---|
| committer | Jeremy Kersten <jke@odoo.com> | 2018-06-22 11:10:50 +0200 |
| commit | df4072b0b493000ccfa4e453d785bcea27659e5c (patch) | |
| tree | 393b3f8eaaa3aa6fc515d9786a105cfb6e9d3eb1 | |
| parent | 55e2d249a62f28604db2e721a0189b3cda7464ad (diff) | |
[FIX] base: keep _get_asset for retro compatibility
Return of _get_assets has been altered with commit 9cd982bcc811cacb4
We keep it for retro compatibility, but devs that override it before need to
override now _get_asset_node to be called correctly by t-call-asset.
| -rw-r--r-- | odoo/addons/base/ir/ir_qweb/ir_qweb.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/odoo/addons/base/ir/ir_qweb/ir_qweb.py b/odoo/addons/base/ir/ir_qweb/ir_qweb.py index 05c3f3f87d7..084ed7e5ae9 100644 --- a/odoo/addons/base/ir/ir_qweb/ir_qweb.py +++ b/odoo/addons/base/ir/ir_qweb/ir_qweb.py @@ -174,7 +174,7 @@ class IrQWeb(models.AbstractModel, QWeb): value=ast.Call( func=ast.Attribute( value=ast.Name(id='self', ctx=ast.Load()), - attr='_get_asset', + attr='_get_asset_nodes', ctx=ast.Load() ), args=[ @@ -286,13 +286,23 @@ class IrQWeb(models.AbstractModel, QWeb): # method called by computing code + # compatibility to remove after v11 - DEPRECATED + @tools.conditional( + 'xml' not in tools.config['dev_mode'], + tools.ormcache_context('xmlid', 'options.get("lang", "en_US")', 'css', 'js', 'debug', 'async', keys=("website_id",)), + ) + def _get_asset(self, xmlid, options, css=True, js=True, debug=False, async=False, values=None): + files, remains = self._get_asset_content(xmlid, options) + asset = AssetsBundle(xmlid, files, remains, env=self.env) + return asset.to_html(css=css, js=js, debug=debug, async=async, url_for=(values or {}).get('url_for', lambda url: url)) + @tools.conditional( # in non-xml-debug mode we want assets to be cached forever, and the admin can force a cache clear # by restarting the server after updating the source code (or using the "Clear server cache" in debug tools) 'xml' not in tools.config['dev_mode'], tools.ormcache_context('xmlid', 'options.get("lang", "en_US")', 'css', 'js', 'debug', 'async', keys=("website_id",)), ) - def _get_asset(self, xmlid, options, css=True, js=True, debug=False, async=False, values=None): + def _get_asset_nodes(self, xmlid, options, css=True, js=True, debug=False, async=False, values=None): files, remains = self._get_asset_content(xmlid, options) asset = AssetsBundle(xmlid, files, env=self.env) remains = [node for node in remains if (css and node[0] == 'link') or (js and node[0] != 'link')] |
