From 23d9b7f3b5a2305cba6fad6f2f124f7d21e3e59b Mon Sep 17 00:00:00 2001 From: pengyuthon Date: Sun, 4 Jan 2026 15:21:24 +0800 Subject: [PATCH] 1 --- preview_easy/controllers/preview.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/preview_easy/controllers/preview.py b/preview_easy/controllers/preview.py index 2d291f472..d6600cb38 100644 --- a/preview_easy/controllers/preview.py +++ b/preview_easy/controllers/preview.py @@ -8,17 +8,12 @@ from odoo import http from odoo.http import request, content_disposition from jinja2 import Environment, PackageLoader import mammoth -from odoo.exceptions import UserError + class preview(http.Controller): @http.route('/web/content/preview/', type='http', method=['Get'], auth="public") def content_preview(self, id=None): ir_attach = request.env['ir.attachment'].sudo() - - # attach = request.env['ir.attachment'].sudo().browse(id) - # if attach.datas: - # raise UserError('附件内容为空,无法预览') - attach = ir_attach.browse(id) image = ['image/jpeg', 'image/png', 'image/bmp', 'image/gif', 'image/jpg', 'image/svg'] html = ['text/html']