projects
/
odoo
/
odoo.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
acaab83
)
[FIX] report: do not fail if PDF cannot be saved as attachment due to AccessError
author
Christophe Simonis
<chs@odoo.com>
Thu, 16 Oct 2014 13:50:26 +0000
(15:50 +0200)
committer
Christophe Simonis
<chs@odoo.com>
Thu, 16 Oct 2014 13:50:26 +0000
(15:50 +0200)
addons/report/models/report.py
patch
|
blob
|
history
diff --git
a/addons/report/models/report.py
b/addons/report/models/report.py
index
c2e1cd2
..
16adc51
100644
(file)
--- a/
addons/report/models/report.py
+++ b/
addons/report/models/report.py
@@
-20,6
+20,7
@@
##############################################################################
from openerp import api
##############################################################################
from openerp import api
+from openerp.exceptions import AccessError
from openerp.osv import osv
from openerp.tools import config, which
from openerp.tools.translate import _
from openerp.osv import osv
from openerp.tools import config, which
from openerp.tools.translate import _
@@
-453,9
+454,14
@@
class Report(osv.Model):
'res_model': save_in_attachment.get('model'),
'res_id': reporthtml[0],
}
'res_model': save_in_attachment.get('model'),
'res_id': reporthtml[0],
}
- self.pool['ir.attachment'].create(cr, uid, attachment)
- _logger.info('The PDF document %s is now saved in the '
- 'database' % attachment['name'])
+ try:
+ self.pool['ir.attachment'].create(cr, uid, attachment)
+ except AccessError:
+ _logger.warning("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:
pdfdocuments.append(pdfreport_path)
except: