summaryrefslogtreecommitdiff
path: root/odoo/addons/base/models/assetsbundle.py
diff options
context:
space:
mode:
authorJorge Pinna Puissant <jpp@odoo.com>2019-10-17 11:41:43 +0000
committerJorge Pinna Puissant <jpp@odoo.com>2020-01-02 13:32:39 +0000
commitc34a1e7f2ff91f8258c34dd485dda7a594aeeb8d (patch)
tree6e991931c6452609b5061f739687f656ef3a2426 /odoo/addons/base/models/assetsbundle.py
parentbd5305a51b9a264b971961aebbdc3e79590e4ad9 (diff)
[FIX] base, website: debug assets in multi-website/multi-company
Fine-tunning of 42eec88e5da164e4930c48113109f2c8d4b73da3 Before this commit, the assets were not found when the user is connected in mode debug assets in a multi-website and multi-company. This occurs because the attachments (assets) were created only for the first website accessed, and cannot be loaded when trying to access the second website. Now, the attachments are created for each website accessed and can be loaded withtout problems. closes odoo/odoo#42593 X-original-commit: 95077a8cdd9f2cd99c2ef85bdf7ca5d58e006b71 Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
Diffstat (limited to 'odoo/addons/base/models/assetsbundle.py')
-rw-r--r--odoo/addons/base/models/assetsbundle.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/odoo/addons/base/models/assetsbundle.py b/odoo/addons/base/models/assetsbundle.py
index 0a8131ac989..4ba5b446d67 100644
--- a/odoo/addons/base/models/assetsbundle.py
+++ b/odoo/addons/base/models/assetsbundle.py
@@ -370,6 +370,12 @@ class AssetsBundle(object):
})("%s");
""" % message.replace('"', '\\"').replace('\n', '&NewLine;')
+ def _get_assets_domain_for_already_processed_css(self, assets):
+ """ Method to compute the attachments' domain to search the already process assets (css).
+ This method was created to be overridden.
+ """
+ return [('url', 'in', list(assets.keys()))]
+
def is_css_preprocessed(self):
preprocessed = True
attachments = None
@@ -381,7 +387,7 @@ class AssetsBundle(object):
outdated = False
assets = dict((asset.html_url, asset) for asset in self.stylesheets if isinstance(asset, atype))
if assets:
- assets_domain = [('url', 'in', list(assets.keys()))]
+ assets_domain = self._get_assets_domain_for_already_processed_css(assets)
attachments = self.env['ir.attachment'].sudo().search(assets_domain)
for attachment in attachments:
asset = assets[attachment.url]
@@ -441,7 +447,7 @@ class AssetsBundle(object):
fname = os.path.basename(asset.url)
url = asset.html_url
with self.env.cr.savepoint():
- self.env['ir.attachment'].sudo().with_context(not_force_website_id=True).create(dict(
+ self.env['ir.attachment'].sudo().create(dict(
datas=base64.b64encode(asset.content.encode('utf8')),
mimetype='text/css',
type='binary',