bzr revid: hmo@tinyerp.com-20081111052750-zqzvr6oaihvt103t
This commit is contained in:
Harshad Modi 2008-11-11 10:57:50 +05:30
parent ad280f3462
commit 83d2edd8c0
1 changed files with 21 additions and 18 deletions

View File

@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
@ -74,28 +74,29 @@ 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
#path = self.path+'/'+self.object2.name + (content.suffix or '') + (content.extension or '')
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)
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
#path = self.path+'/'+self.object2.name + (content.suffix or '') + (content.extension or '')
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,'=',nodename) )
print where+[ ('parent_id','=',self.object and self.object.id or False) ]
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)
@ -560,6 +561,7 @@ class document_file(osv.osv):
if not self._check_duplication(cr,uid,vals):
raise except_orm('ValidateError', 'File name must be unique!')
result = super(document_file,self).write(cr,uid,ids,vals,context=context)
cr.commit()
try:
for f in self.browse(cr, uid, ids, context=context):
if 'datas' not in vals:
@ -568,6 +570,7 @@ class document_file(osv.osv):
super(document_file,self).write(cr, uid, ids, {
'index_content': res
})
cr.commit()
except:
pass
return result