mirror of
https://github.com/OCA/knowledge.git
synced 2025-07-20 10:16:45 -06:00
[FIX] attachment_preview: fix get_binary_extension
This commit is contained in:
parent
89fb9a0417
commit
942f04b824
@ -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
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user