summaryrefslogtreecommitdiff
path: root/addons/document
diff options
context:
space:
mode:
authorHarry (Open ERP) <hmo@tinyerp.com>2009-11-04 12:16:25 +0530
committerHarry (Open ERP) <hmo@tinyerp.com>2009-11-04 12:16:25 +0530
commit1256d1c8ee5d0fb6e5f4ff6abf84112a3e6f7fe5 (patch)
tree929323d1065052a4c3027ffabe8a4bc1403e1756 /addons/document
parentbd8f4ee41e2d24e38699b6b874ffc5098b6ae6cc (diff)
parent7022a6016f826c2c5d475aec6fc079e3e82ba8bc (diff)
[merge] merge stable/5.0 branch
bzr revid: hmo@tinyerp.com-20091104064625-8ufxibenj12wxj3o
Diffstat (limited to 'addons/document')
-rw-r--r--addons/document/document.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/addons/document/document.py b/addons/document/document.py
index 10b49ecabe9..3ce6a9d700f 100644
--- a/addons/document/document.py
+++ b/addons/document/document.py
@@ -530,17 +530,21 @@ class document_file(osv.osv):
result[id] = base64.encodestring(value)
except:
result[id]=''
-
- if context.get('bin_size', False):
- result[id] = tools.human_size(len(result[id]))
-
+# if context.get('bin_size', False):
+# result[id] = tools.human_size(result[id])
return result
#
# This code can be improved
#
- def _data_set(self, cr, obj, id, name, value, uid=None, context={}):
+ def _data_set(self, cr, uid, id, name, value, args=None, context={}):
if not value:
+ filename = self.browse(cr, uid, id, context).store_fname
+ try:
+ os.unlink(os.path.join(self._get_filestore(cr), filename))
+ except:
+ pass
+ cr.execute('update ir_attachment set store_fname=NULL WHERE id=%s', (id,) )
return True
#if (not context) or context.get('store_method','fs')=='fs':
try: