[FIX] Document : error on create if attachment not specified

bzr revid: jvo@tinyerp.com-20090828111159-yoe862iefxw2h3uo
This commit is contained in:
Jay (Open ERP)
2009-08-28 16:41:59 +05:30
parent 369221b471
commit 72cfa7cf23
+3 -2
View File
@@ -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)