[MIG] attachment_zipped_download: Migration to 18.0

TT54112
This commit is contained in:
Víctor Martínez
2025-01-28 08:23:20 +01:00
parent 7e256cfaa8
commit 25dba93d16
7 changed files with 23 additions and 22 deletions

View File

@@ -4,7 +4,7 @@
import zipfile
from io import BytesIO
from odoo import _, models
from odoo import models
from odoo.exceptions import UserError
@@ -15,12 +15,12 @@ class IrAttachment(models.Model):
items = self.filtered(lambda x: x.type == "binary")
if not items:
raise UserError(
_("None attachment selected. Only binary attachments allowed.")
self.env._("None attachment selected. Only binary attachments allowed.")
)
ids = ",".join(map(str, items.ids))
return {
"type": "ir.actions.act_url",
"url": "/web/attachment/download_zip?ids=%s" % (ids),
"url": f"/web/attachment/download_zip?ids={ids}",
"target": "self",
}