[FIX] base, website: remove dead code
Looks like this is not useful since #66169 This cleanup was initially in #97879 closes odoo/odoo#112685 Signed-off-by: Vincent Schippefilt (vsc) <vsc@odoo.com>
This commit is contained in:
@@ -26,12 +26,6 @@ class AssetsBundleMultiWebsite(AssetsBundle):
|
||||
res = super(AssetsBundleMultiWebsite, self)._get_asset_url_values(id, unique, extra, name, sep, extension)
|
||||
return res
|
||||
|
||||
def _get_assets_domain_for_already_processed_css(self, assets):
|
||||
res = super(AssetsBundleMultiWebsite, self)._get_assets_domain_for_already_processed_css(assets)
|
||||
current_website = self.env['website'].get_current_website(fallback=False)
|
||||
res = expression.AND([res, current_website.website_domain()])
|
||||
return res
|
||||
|
||||
def get_debug_asset_url(self, extra='', name='%', extension='%'):
|
||||
website_id = self.env.context.get('website_id')
|
||||
website_id_path = website_id and ('%s/' % website_id) or ''
|
||||
|
||||
@@ -662,44 +662,6 @@ class AssetsBundle(object):
|
||||
|
||||
return css_attachment
|
||||
|
||||
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
|
||||
old_attachments = self.env['ir.attachment'].sudo()
|
||||
asset_types = [SassStylesheetAsset, ScssStylesheetAsset, LessStylesheetAsset]
|
||||
if self.user_direction == 'rtl':
|
||||
asset_types.append(StylesheetAsset)
|
||||
|
||||
for atype in asset_types:
|
||||
outdated = False
|
||||
assets = dict((asset.html_url, asset) for asset in self.stylesheets if isinstance(asset, atype))
|
||||
if assets:
|
||||
assets_domain = self._get_assets_domain_for_already_processed_css(assets)
|
||||
attachments = self.env['ir.attachment'].sudo().search(assets_domain)
|
||||
old_attachments += attachments
|
||||
for attachment in attachments:
|
||||
asset = assets[attachment.url]
|
||||
if asset.last_modified > attachment.write_date:
|
||||
outdated = True
|
||||
break
|
||||
if asset._content is None:
|
||||
asset._content = (attachment.raw or b'').decode('utf8')
|
||||
if not asset._content and attachment.file_size > 0:
|
||||
asset._content = None # file missing, force recompile
|
||||
|
||||
if any(asset._content is None for asset in assets.values()):
|
||||
outdated = True
|
||||
|
||||
if outdated:
|
||||
preprocessed = False
|
||||
|
||||
return preprocessed, old_attachments
|
||||
|
||||
def preprocess_css(self, debug=False, old_attachments=None):
|
||||
"""
|
||||
Checks if the bundle contains any sass/less content, then compiles it to css.
|
||||
|
||||
Reference in New Issue
Block a user