From 4f9faa7f009a1298d4a45e7bcaeab028426a565c Mon Sep 17 00:00:00 2001 From: "Harry (Open ERP)" Date: Thu, 1 Jan 2009 15:55:30 +0530 Subject: [PATCH] fixed bug : display content if static directiory bzr revid: hmo@tinyerp.com-20090101102530-6fa7wv1e8bguhsvy --- addons/document/document.py | 35 +++++++++++----------- addons/document/ftpserver/abstracted_fs.py | 2 ++ 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/addons/document/document.py b/addons/document/document.py index 3d0b0176dce..5a0a3cefb0f 100644 --- a/addons/document/document.py +++ b/addons/document/document.py @@ -87,27 +87,28 @@ class node_class(object): if self.object2: where.append( ('res_model','=',self.object2._name) ) where.append( ('res_id','=',self.object2.id) ) - for content in self.object.content_ids: - if self.object2 or not content.include_name: - if content.include_name: - test_nodename = self.object2.name + (content.suffix or '') + (content.extension or '') - else: - test_nodename = (content.suffix or '') + (content.extension or '') - if test_nodename.find('/'): - test_nodename=test_nodename.replace('/', '_') - path = self.path+'/'+test_nodename - if not nodename: - n = node_class(self.cr, self.uid,path, self.object2, False, content=content, type='content', root=False) - res2.append( n) - else: - if nodename == test_nodename: - n = node_class(self.cr, self.uid, path, self.object2, False, content=content, type='content', root=False) - res2.append(n) else: where.append( ('parent_id','=',self.object.id) ) where.append( ('res_id','=',False) ) if nodename: - where.append( (fobj._rec_name,'like',nodename) ) + where.append( (fobj._rec_name,'like',nodename) ) + for content in self.object.content_ids: + if self.object2 or not content.include_name: + if content.include_name: + test_nodename = self.object2.name + (content.suffix or '') + (content.extension or '') + else: + test_nodename = (content.suffix or '') + (content.extension or '') + if test_nodename.find('/'): + test_nodename=test_nodename.replace('/', '_') + path = self.path+'/'+test_nodename + if not nodename: + n = node_class(self.cr, self.uid,path, self.object2, False, content=content, type='content', root=False) + res2.append( n) + else: + if nodename == test_nodename: + n = node_class(self.cr, self.uid, path, self.object2, False, content=content, type='content', root=False) + res2.append(n) + ids = fobj.search(self.cr, self.uid, where+[ ('parent_id','=',self.object and self.object.id or False) ], context=self.context) if self.object and self.root and (self.object.type=='ressource'): ids += fobj.search(self.cr, self.uid, where+[ ('parent_id','=',False) ], context=self.context) diff --git a/addons/document/ftpserver/abstracted_fs.py b/addons/document/ftpserver/abstracted_fs.py index fe64ab44063..b7a06cf6d80 100644 --- a/addons/document/ftpserver/abstracted_fs.py +++ b/addons/document/ftpserver/abstracted_fs.py @@ -26,6 +26,7 @@ class file_wrapper(StringIO.StringIO): def close(self, *args, **kwargs): db,pool = pooler.get_db_and_pool(self.dbname) cr = db.cursor() + cr.commit() try: val = self.getvalue() val2 = { @@ -49,6 +50,7 @@ class content_wrapper(StringIO.StringIO): def close(self, *args, **kwargs): db,pool = pooler.get_db_and_pool(self.dbname) cr = db.cursor() + cr.commit() try: getattr(self.pool.get('document.directory.content'), 'process_write_'+self.node.content.extension[1:])(cr, self.uid, self.node, self.getvalue()) finally: