diff options
| author | Mantavya Gajjar <mga@tinyerp.com> | 2009-11-02 15:47:29 +0530 |
|---|---|---|
| committer | Mantavya Gajjar <mga@tinyerp.com> | 2009-11-02 15:47:29 +0530 |
| commit | 80de59bebbc6ce922dc0af23e6f21c62114344de (patch) | |
| tree | 72481c500f2e29cf754851bc52bb3c0aeef7d8cb /addons/document/document.py | |
| parent | e7a50c6a8f5c11adac5a2c05c6db86c5dc62bef9 (diff) | |
| parent | e364cf15b3c52cf04c9178f1cf53bb7591e61293 (diff) | |
[MERGE]: merging from the sam branch
bzr revid: mga@tinyerp.com-20091102101729-jdnly7040sa9lnub
Diffstat (limited to 'addons/document/document.py')
| -rw-r--r-- | addons/document/document.py | 14 |
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: |
