From 4741259d1422dbac8d7177a0d4fca795a56cc911 Mon Sep 17 00:00:00 2001 From: "Harry (Open ERP)" Date: Wed, 10 Feb 2010 14:25:33 +0530 Subject: [PATCH] [IMP] document: if storage media is not specify in file , it should take db storage on get datas bzr revid: hmo@tinyerp.com-20100210085533-54502lynruy569pn --- addons/document/nodes.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/addons/document/nodes.py b/addons/document/nodes.py index 6181b5678e8..c6e2f1b10d1 100644 --- a/addons/document/nodes.py +++ b/addons/document/nodes.py @@ -598,7 +598,8 @@ class node_file(node_class): if fil.parent_id: self.storage_id = fil.parent_id.storage_id.id else: - self.storage_id = None + self.storage_id = None + def get_data(self, cr, fil_obj = None): """ Retrieve the data for some file. @@ -607,12 +608,20 @@ class node_file(node_class): the browse object. """ # this is where storage kicks in.. stor = self.storage_id + if not stor: + data_obj = self.context._dirobj.pool.get('ir.model.data') + data_id = data_obj._get_id(cr, self.context.uid, 'document', 'storage_db') + if data_id: + stor = data_obj.browse(cr, self.context.uid, data_id, context=self.context.context).res_id assert stor stobj = self.context._dirobj.pool.get('document.storage') return stobj.get_data(cr,self.context.uid,stor, self,self.context.context, fil_obj) def get_data_len(self, cr, fil_obj = None): # TODO: verify with the storage object! + bin_size = self.context.context.get('bin_size', False) + if bin_size and not self.content_length: + self.content_length = fil_obj.db_datas return self.content_length def set_data(self, cr, data, fil_obj = None):