From f8adfe72ddc4862781bf1db9aa27804b36a74828 Mon Sep 17 00:00:00 2001 From: Xavier-Do Date: Tue, 14 Feb 2023 13:43:48 +0000 Subject: [PATCH] [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) --- addons/website/models/ir_qweb.py | 6 ---- odoo/addons/base/models/assetsbundle.py | 38 ------------------------- 2 files changed, 44 deletions(-) diff --git a/addons/website/models/ir_qweb.py b/addons/website/models/ir_qweb.py index a9c80dca20e..26e0f3c9388 100644 --- a/addons/website/models/ir_qweb.py +++ b/addons/website/models/ir_qweb.py @@ -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 '' diff --git a/odoo/addons/base/models/assetsbundle.py b/odoo/addons/base/models/assetsbundle.py index cc7c55fda42..f4dbf7af2c6 100644 --- a/odoo/addons/base/models/assetsbundle.py +++ b/odoo/addons/base/models/assetsbundle.py @@ -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.