[FIX] base: return all the css attachments

When detecting if the assets where already preprocessed, the method
only the last asset type matching was returned and deleted.
In standard, it should not have any impact as all assets are of the
same type but it may be possible to mix it with external modules.

Sign CLA

closes odoo/odoo#79786

X-original-commit: 0c2f83f4a6c4603d107007ac77c94e6a2805cd81
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
This commit is contained in:
张文广
2021-11-15 16:41:28 +00:00
committed by Martin Trigaux
parent 3882ec7c39
commit d0d8d28cba
+3 -2
View File
@@ -538,7 +538,7 @@ class AssetsBundle(object):
def is_css_preprocessed(self):
preprocessed = True
attachments = None
old_attachments = self.env['ir.attachment']
asset_types = [SassStylesheetAsset, ScssStylesheetAsset, LessStylesheetAsset]
if self.user_direction == 'rtl':
asset_types.append(StylesheetAsset)
@@ -549,6 +549,7 @@ class AssetsBundle(object):
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['__last_update']:
@@ -565,7 +566,7 @@ class AssetsBundle(object):
if outdated:
preprocessed = False
return preprocessed, attachments
return preprocessed, old_attachments
def preprocess_css(self, debug=False, old_attachments=None):
"""