diff --git a/odoo/addons/base/models/ir_actions_report.py b/odoo/addons/base/models/ir_actions_report.py index 327d75dfcbe..dfa31797db9 100644 --- a/odoo/addons/base/models/ir_actions_report.py +++ b/odoo/addons/base/models/ir_actions_report.py @@ -807,6 +807,14 @@ class IrActionsReport(models.Model): if stream_data['attachment']: continue + # if res_id is false + # we are unable to fetch the record, it won't be saved as we can't split the documents unambiguously + if not res_id: + _logger.warning( + "These documents were not saved as an attachment because the template of %s doesn't " + "have any headers seperating different instances of it. If you want it saved," + "please print the documents separately", report_sudo.report_name) + continue record = self.env[report_sudo.model].browse(res_id) attachment_name = safe_eval(report_sudo.attachment, {'object': record, 'time': time})