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']