diff options
| author | atp (Open ERP) <atp@tinyerp.co.in> | 2010-12-20 18:24:19 +0530 |
|---|---|---|
| committer | atp (Open ERP) <atp@tinyerp.co.in> | 2010-12-20 18:24:19 +0530 |
| commit | ebd5c62dbc6ffa689ea36b85951c4202e1317dac (patch) | |
| tree | c96b65b330a0303b044613322f2bc0efc166bed6 /addons/document/document.py | |
| parent | 648d6353ef92954995caaf426c24b650c1114530 (diff) | |
[FIX]: solved Problem of after install document module, documents are lost which are added before installed document module
bzr revid: atp@tinyerp.co.in-20101220125419-y99i8aqw3y1s00by
Diffstat (limited to 'addons/document/document.py')
| -rw-r--r-- | addons/document/document.py | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/addons/document/document.py b/addons/document/document.py index 7e575f38a37..c1c06711faa 100644 --- a/addons/document/document.py +++ b/addons/document/document.py @@ -46,15 +46,25 @@ class document_file(osv.osv): # nctx will /not/ inherit the caller's context. Most of # it would be useless, anyway (like active_id, active_model, # bin_size etc.) + result = {} bin_size = context.get('bin_size', False) for fbro in fbrl: - fnode = nodes.node_file(None, None, nctx, fbro) + if not fbro.parent_id: + cr.execute("select db_datas from ir_attachment where id = %s" ,(fbro.id,)) + res = cr.fetchone() + datas = res[0] or '' + size = len(datas) + else: + fnode = nodes.node_file(None, None, nctx, fbro) + datas = fnode.get_data(cr, fbro) + datas = base64.encodestring(datas or '') + size = fnode.get_data_len(cr, fbro) + if not bin_size: - data = fnode.get_data(cr, fbro) - result[fbro.id] = base64.encodestring(data or '') + result[fbro.id] = datas else: - result[fbro.id] = fnode.get_data_len(cr, fbro) + result[fbro.id] = size return result |
