summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVo Minh Thu <vmt@openerp.com>2012-02-10 12:34:27 +0100
committerVo Minh Thu <vmt@openerp.com>2012-02-10 12:34:27 +0100
commit799752a74b2bc20071068ec8361ba136a79e5259 (patch)
treef47139916412658fa6c15cea5aaa204ecfd76f8f
parenta04e39233c6446c2adcbc6db1ae27ae1019c2a0d (diff)
[FIX] report: do not use the default_type entry from the context:
the type column exists on both the account_invoice and on the attachment. It is set for the account_invoice, so we must not use it for the attachment creation. lp bug: https://launchpad.net/bugs/918203 fixed bzr revid: vmt@openerp.com-20120210113427-vnty3pcmcw3g3b97
-rw-r--r--openerp/report/report_sxw.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/openerp/report/report_sxw.py b/openerp/report/report_sxw.py
index b521a16a700..a1ceae9ae2b 100644
--- a/openerp/report/report_sxw.py
+++ b/openerp/report/report_sxw.py
@@ -474,13 +474,19 @@ class report_sxw(report_rml, preprocess.report):
if aname:
try:
name = aname+'.'+result[1]
+ # Remove the default_type entry from the context: this
+ # is for instance used on the account.account_invoices
+ # and is thus not intended for the ir.attachment type
+ # field.
+ ctx = dict(context)
+ ctx.pop('default_type', None)
pool.get('ir.attachment').create(cr, uid, {
'name': aname,
'datas': base64.encodestring(result[0]),
'datas_fname': name,
'res_model': self.table,
'res_id': obj.id,
- }, context=context
+ }, context=ctx
)
except Exception:
#TODO: should probably raise a proper osv_except instead, shouldn't we? see LP bug #325632