[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
This commit is contained in:
Harry (Open ERP)
2010-02-10 14:25:33 +05:30
parent d9de088909
commit 4741259d14
+10 -1
View File
@@ -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):