From bba02abfddd63d40945a29f8ab31e0938506ad3a Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Tue, 29 Jun 2010 16:58:41 +0300 Subject: [PATCH] Document: fix the storage_id of node_file. Not all directories have a storage_id. Instead, we have to traverse the hierarchy up until we find one that has storage. bzr revid: p_christ@hol.gr-20100629135841-5myx5hyuijwv95si --- addons/document/nodes.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/addons/document/nodes.py b/addons/document/nodes.py index 932cab7a32d..c28b6d07b93 100644 --- a/addons/document/nodes.py +++ b/addons/document/nodes.py @@ -684,10 +684,14 @@ class node_file(node_class): # This only propagates the problem to get_data. Better # fix those files to point to the root dir. - if fil.parent_id: - self.storage_id = fil.parent_id.storage_id.id - else: - self.storage_id = None + self.storage_id = None + par = fil.parent_id + while par: + if par.storage_id and par.storage_id.id: + self.storage_id = par.storage_id.id + break + par = par.parent_id + def open(self, cr, mode=False): uid = self.context.uid