Merge PR #461 into 14.0

Signed-off-by pedrobaeza
This commit is contained in:
OCA-git-bot 2024-02-19 10:34:04 +00:00
commit 16e110ccfa
2 changed files with 10 additions and 0 deletions

View File

@ -41,6 +41,8 @@ class IrAttachment(models.Model):
ids_to_browse = [_id for _id in ids_to_browse if _id not in result]
for this in self.env[model].with_context(bin_size=True).browse(ids_to_browse):
result[this.id] = False
if not this[binary_field]:
continue
try:
import magic

View File

@ -35,3 +35,11 @@ class TestAttachmentPreview(TransactionCase):
"ir.module.module", module.id, "icon_image"
)
self.assertTrue(res3)
module = (
self.env["ir.ui.menu"].search([]).filtered(lambda m: not m.web_icon_data)[0]
)
res4 = self.env["ir.attachment"].get_binary_extension(
"ir.ui.menu", module.id, "web_icon_data"
)
self.assertFalse(res4)