From a95319ace39a4da7b2b2932b076b3582c824f99a Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Fri, 25 Jun 2010 16:51:39 +0300 Subject: [PATCH] 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 --- addons/document/nodes.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/addons/document/nodes.py b/addons/document/nodes.py index dcd864e6db0..983ec2ac951 100644 --- a/addons/document/nodes.py +++ b/addons/document/nodes.py @@ -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)