Skip to Content
Menu
This question has been flagged
2 Replies
5345 Views

When I generate a report in pdf I create an attachment and I don't want it. I looked at the report module and found this:

# Save the pdf in attachment if marked
if reporthtml[0] is not False and save_in_attachment.get(reporthtml[0]):
with open(pdfreport_path, 'rb') as pdfreport:
attachment = {
'name': save_in_attachment.get(reporthtml[0]),
'datas': base64.encodestring(pdfreport.read()),
'datas_fname': save_in_attachment.get(reporthtml[0]),
'res_model': save_in_attachment.get('model'),
'res_id': reporthtml[0],
}
try:
self.env['ir.attachment'].create(attachment)
except AccessError:
_logger.info("Cannot save PDF report %r as attachment", attachment['name'])
else:
_logger.info('The PDF document %s is now saved in the database',
attachment['name'])

pdfdocuments.append(pdfreport_path)
except:
raise
# Save the pdf in attachment if marked

That means there's a check button that enables or disables the option, right?

EDIT: I would like to know how to disable it in both odoo 8 and odoo 10


Avatar
Discard
Author Best Answer

Thanks, but what I want is for odoo not to generate reports automatically.

Avatar
Discard
Best Answer

Hi,

If you activate the developer mode and navigate to Settings -> Technical -> Reporting -> Reports , and search for your report or open any report. You can see a boolean field in the form named Reload from attachment, unticking this field will help you.


Thanks

Avatar
Discard
Related Posts Replies Views Activity
1
Apr 23
926
1
Jun 20
2380
3
Jun 17
5205
0
Apr 21
2286
1
Aug 18
5951