Document: do not allow nodes without storage.
Every file must be linked to a storage, through its parent directory. If not, it is just a programming error. bzr revid: p_christ@hol.gr-20100625135139-u5r0y4fouz2i1av6
This commit is contained in:
parent
47f486b2cf
commit
a95319ace3
|
@ -738,12 +738,9 @@ 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
|
||||
assert stor, "No storage for file #%s" % self.file_id
|
||||
# If storage is not set properly, we are just screwed here, don't
|
||||
# try to get it from default.
|
||||
stobj = self.context._dirobj.pool.get('document.storage')
|
||||
return stobj.get_data(cr, self.context.uid,stor, self,self.context.context, fil_obj)
|
||||
|
||||
|
|
Loading…
Reference in New Issue