preview easy
This commit is contained in:
@@ -9,9 +9,13 @@ from odoo.http import request, content_disposition
|
||||
from jinja2 import Environment, PackageLoader
|
||||
import mammoth
|
||||
|
||||
import logging
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class preview(http.Controller):
|
||||
@http.route('/web/content/preview/<int:id>', type='http', method=['Get'], auth="public")
|
||||
@http.route('/web/content/preview/<int:id>', type='http', method=['Get'], auth="user")
|
||||
def content_preview(self, id=None):
|
||||
ir_attach = request.env['ir.attachment'].sudo()
|
||||
attach = ir_attach.browse(id)
|
||||
@@ -40,7 +44,7 @@ class preview(http.Controller):
|
||||
# base_url = request.env['ir.config_parameter'].sudo().get_param('web.base.url')
|
||||
# html = f'{office_view_url}{quote(base_url + "/web/content/office_preview/" + str(attach.id))}'
|
||||
target_url = f'/onlyoffice/editor/{str(attach.id)}'
|
||||
return self.redirect(target_url)
|
||||
return werkzeug.utils.redirect(target_url)
|
||||
# return werkzeug.wrappers.Response(f"""
|
||||
# <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
# "http://www.w3.org/TR/html4/loose.dtd">
|
||||
|
||||
Reference in New Issue
Block a user