summaryrefslogtreecommitdiff
path: root/addons/document/document.py
diff options
context:
space:
mode:
authorAlbert Cervera i Areny <>2009-10-26 21:08:17 +0530
committerJay (Open ERP) <jvo@tinyerp.com>2009-10-26 21:08:17 +0530
commitba53d85a07a36040a4110a01db6c9c1d7ed6043e (patch)
tree58df0ba30a0d63ffa2cd1704f59aab7882f27a61 /addons/document/document.py
parentbe63c95cb212dacdef0f1a0279ccd25ce087ac59 (diff)
[FIX] Document : Attachment with document can now be deleted
lp bug: https://launchpad.net/bugs/460701 fixed bzr revid: jvo@tinyerp.com-20091026153817-cn3mmj43ng90ymyp
Diffstat (limited to 'addons/document/document.py')
-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 460c52a9698..338c6e69255 100644
--- a/addons/document/document.py
+++ b/addons/document/document.py
@@ -531,17 +531,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: