summaryrefslogtreecommitdiff
path: root/addons/document/document.py
diff options
context:
space:
mode:
authorJay (Open ERP) <jvo@tinyerp.com>2009-08-28 16:41:59 +0530
committerJay (Open ERP) <jvo@tinyerp.com>2009-08-28 16:41:59 +0530
commit72cfa7cf230d05420fda85c8ee3249571689d9ba (patch)
tree2a7c1290b90a6dfa5bc38173458dbe9ef441b111 /addons/document/document.py
parent369221b47101072e094ad2d02fe2edd2b47690aa (diff)
[FIX] Document : error on create if attachment not specified
bzr revid: jvo@tinyerp.com-20090828111159-yoe862iefxw2h3uo
Diffstat (limited to 'addons/document/document.py')
-rw-r--r--addons/document/document.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/addons/document/document.py b/addons/document/document.py
index 3450d3a51a4..21aa59661a7 100644
--- a/addons/document/document.py
+++ b/addons/document/document.py
@@ -695,8 +695,9 @@ class document_file(osv.osv):
import urllib
datas=base64.encodestring(urllib.urlopen(vals['link']).read())
else:
- datas=vals.get('datas',False)
- vals['file_size']= len(datas)
+ datas = vals.get('datas',False)
+
+ vals['file_size']= datas and len(datas) or 0
if not self._check_duplication(cr,uid,vals):
raise except_orm(_('ValidateError'), _('File name must be unique!'))
result = super(document_file,self).create(cr, uid, vals, context)