diff --git a/preview_easy/controllers/preview.py b/preview_easy/controllers/preview.py index 7a7c262bd..992c1bf12 100644 --- a/preview_easy/controllers/preview.py +++ b/preview_easy/controllers/preview.py @@ -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/', type='http', method=['Get'], auth="public") + @http.route('/web/content/preview/', type='http', method=['Get'], auth="user") def content_preview(self, id=None): ir_attach = request.env['ir.attachment'].sudo() attach = ir_attach.browse(id) @@ -36,21 +40,23 @@ class preview(http.Controller): # return template.render(html=html) elif attach.mimetype in excel or word: # 'http://view.officeapps.live.com/op/view.aspx?src=https://oa.thtzjt.com/web/content/office_preview/' - office_view_url = 'http://view.officeapps.live.com/op/view.aspx?src=' - 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))}' - return werkzeug.wrappers.Response(f""" - - - - - - - - - - """, status=200, headers=[('Content-Type', 'text/html'), ('charset', 'utf-8')]) + # office_view_url = 'http://view.officeapps.live.com/op/view.aspx?src=' + # 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 werkzeug.utils.redirect(target_url) + # return werkzeug.wrappers.Response(f""" + # + # + # + # + # + # + # + # + # + # """, status=200, headers=[('Content-Type', 'text/html'), ('charset', 'utf-8')]) else: return werkzeug.wrappers.Response('This format is not currently supported', status=200, headers=[('Content-Type', 'text/html'),('charset','utf-8')]) diff --git a/soong_workflow/views/soong_workflow_record.xml b/soong_workflow/views/soong_workflow_record.xml index 443971c71..88f7dcc3e 100644 --- a/soong_workflow/views/soong_workflow_record.xml +++ b/soong_workflow/views/soong_workflow_record.xml @@ -275,7 +275,7 @@ soong.workflow.record