changes
This commit is contained in:
@@ -1,28 +1,37 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from odoo import models, tools
|
||||
from odoo.exceptions import ValidationError, UserError
|
||||
import traceback
|
||||
|
||||
from odoo import fields, models, tools
|
||||
from odoo.exceptions import ValidationError, UserError
|
||||
|
||||
class Http(models.Model):
|
||||
|
||||
class IrActionsReport(models.Model):
|
||||
_inherit = "ir.actions.report"
|
||||
|
||||
fusion_preview_mode = fields.Selection([
|
||||
('default', 'Use User Preference'),
|
||||
('preview', 'Always Preview'),
|
||||
('download', 'Always Download'),
|
||||
('auto_print', 'Always Auto-Print'),
|
||||
], string='PDF Preview Mode', default='default',
|
||||
help='Override user-level PDF preview settings for this specific report.')
|
||||
|
||||
def _render_qweb_pdf(self, report_ref, res_ids=None, data=None):
|
||||
if tools.config['test_enable'] or tools.config['test_file']:
|
||||
return super()._render_qweb_pdf(report_ref, res_ids=res_ids, data=data)
|
||||
|
||||
result = False, False
|
||||
messageError = False
|
||||
message_error = False
|
||||
try:
|
||||
result = super()._render_qweb_pdf(report_ref, res_ids=res_ids, data=data)
|
||||
except (UserError, ValidationError) as e:
|
||||
messageError = str(e)
|
||||
except Exception as e:
|
||||
messageError = traceback.format_exc()
|
||||
message_error = str(e)
|
||||
except Exception:
|
||||
message_error = traceback.format_exc()
|
||||
|
||||
if messageError:
|
||||
report_ref = "pdf_print_preview.report_error_catcher"
|
||||
data = {'error': messageError}
|
||||
if message_error:
|
||||
report_ref = "fusion_pdf_preview.report_error_catcher"
|
||||
data = {'error': message_error}
|
||||
result = super()._render_qweb_pdf(report_ref, res_ids=[], data=data)
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user