bzr revid: fp@tinyerp.com-20090414192143-q00r4quugs8p0oat
This commit is contained in:
Fabien Pinckaers
2009-04-14 21:21:43 +02:00
5 changed files with 69 additions and 76 deletions
+8 -42
View File
@@ -98,22 +98,7 @@
<paraStyle name="P14" rightIndent="17.0" leftIndent="-0.0" fontName="Helvetica" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
<blockTableStyle id="TrLevel8">
<blockLeftPadding length="100" start="1,0" stop="1,0"/>
</blockTableStyle>
<blockTableStyle id="TrLevel7">
<blockLeftPadding length="80" start="1,0" stop="1,0"/>
</blockTableStyle>
<blockTableStyle id="TrLevel6">
<blockLeftPadding length="60" start="1,0" stop="1,0"/>
</blockTableStyle>
<blockTableStyle id="TrLevel5">
<blockLeftPadding length="40" start="1,0" stop="1,0"/>
</blockTableStyle>
<blockTableStyle id="TrLevel4">
<blockLeftPadding length="20" start="1,0" stop="1,0"/>
</blockTableStyle>
<blockTableStyle id="TrLevel3">
<blockTableStyle id="TrLevel">
<blockLeftPadding length="0" start="1,0" stop="1,0"/>
</blockTableStyle>
<blockTableStyle id="TrLevel2">
@@ -131,34 +116,13 @@
<blockFont name="Times-Bold" start="0,0" stop="-1,-1"/>
</blockTableStyle>
<paraStyle
name="Level8"
fontName="Helvetica"
fontSize="8.0" />
<paraStyle
name="Level7"
fontName="Helvetica"
fontSize="8.0" />
<paraStyle
name="Level6"
fontName="Helvetica"
fontSize="8.0" />
<paraStyle
name="Level5"
fontName="Helvetica"
fontSize="8.0" />
<paraStyle
name="Level4"
fontName="Helvetica"
fontSize="8.0" />
<paraStyle
name="Level3"
<paraStyle
name="Level"
fontName="Helvetica"
fontSize="8.0" />
<paraStyle
name="Level2"
firstLineIndent="-0.03cm"
fontName="Helvetica-Bold"
fontSize="8.0" />
<paraStyle name="Level1"
@@ -210,8 +174,10 @@
<td><para style="P14">[[ repeatIn(lines(data['form']), 'a') ]]<i>[[ a['code'] or removeParentNode('tr') ]]</i></para></td>
<td>
<para style="P14">[[ setTag('tr','tr',{'style':'TrLevel'+str(a['level']), 'paraStyle':('Level'+str(a['level']))}) ]]<font></font>
[[ a['name'] ]]</para>
<para style="P14">
<font>[[ (a['level']&lt;3 and setTag('tr','tr',{'style':'TrLevel'+str(a['level']), 'paraStyle':('Level'+str(a['level']))})) or removeParentNode('font') ]]</font>
<font>[[ (a['level']&gt;2 and setTag('tr','tr',{'style':'TrLevel', 'paraStyle':('Level')})) or removeParentNode('font') ]] </font>
<font color="white">[[ '...'*(a['level']) ]]</font> [[ a['name'] ]]</para>
</td>
<td>
<para style="P3"><font>[[ a['type']=='view' and removeParentNode('font') ]][[ formatLang(a['debit']) ]]</font>
+2 -2
View File
@@ -59,9 +59,9 @@ class account_report(osv.osv):
def _calc_context(key,obj):
if key==0:
return obj.find(cr,uid)
return obj.find(cr,uid,exception=False)
else:
obj_key=obj.browse(cr,uid,obj.find(cr,uid))
obj_key=obj.browse(cr,uid,obj.find(cr,uid,exception=False))
if isinstance(obj_key,list):
obj_key=obj_key[0]
key_ids=obj.search(cr,uid,[('date_stop','<',obj_key.date_start)])
+35 -20
View File
@@ -155,6 +155,11 @@ class node_class(object):
where = self.object.domain and eval(self.object.domain, {'active_id':self.root}) or []
pool = pooler.get_pool(self.cr.dbname)
obj = pool.get(self.object.ressource_type_id.model)
if len(obj.fields_get(self.cr, self.uid, ['dirname'])):
_dirname_field = 'dirname'
else:
_dirname_field = 'name'
name_for = obj._name.split('.')[-1]
if nodename and nodename.find(name_for) == 0 :
id = int(nodename.replace(name_for,''))
@@ -164,16 +169,12 @@ class node_class(object):
nodename=nodename.replace('__','/')
for invalid in INVALID_CHARS:
if nodename.find(INVALID_CHARS[invalid]) :
nodename=nodename.replace(INVALID_CHARS[invalid],invalid)
where.append(('name','like',nodename))
nodename=nodename.replace(INVALID_CHARS[invalid],invalid)
where.append((_dirname_field,'like',nodename))
if self.object.ressource_tree:
if obj._parent_name in obj.fields_get(self.cr,self.uid):
where.append((obj._parent_name,'=',self.object2 and self.object2.id or False))
ids = obj.search(self.cr, self.uid, where, self.context)
res = obj.browse(self.cr, self.uid, ids,self.context)
result+= map(lambda x: node_class(self.cr, self.uid, self.path+'/'+x.name.replace('/','__'), self.object, x, root=x.id), res)
return result
where.append((obj._parent_name,'=',self.object2 and self.object2.id or False))
else :
if self.object2:
return result
@@ -183,16 +184,30 @@ class node_class(object):
ids = obj.search(self.cr, self.uid, where, self.context)
res = obj.browse(self.cr, self.uid, ids,self.context)
for r in res:
if not r.name:
r.name = name_for+'%d'%r.id
for invalid in INVALID_CHARS:
if r.name.find(invalid) :
r.name=r.name.replace(invalid,INVALID_CHARS[invalid])
result2 = map(lambda x: node_class(self.cr, self.uid, self.path+'/'+x.name.replace('/','__'), self.object, x, root=x.id), res)
res = obj.browse(self.cr, self.uid, ids,self.context)
if _dirname_field == 'dirname':
for r in res:
if not r.dirname:
r.dirname = name_for+'%d'%r.id
for invalid in INVALID_CHARS:
if r.dirname.find(invalid) :
r.dirname=r.dirname.replace(invalid,INVALID_CHARS[invalid])
result2 = map(lambda x: node_class(self.cr, self.uid, self.path+'/'+x.dirname.replace('/','__'), self.object, x, root=x.id), res)
else:
for r in res:
if not r.name:
r.name = name_for+'%d'%r.id
for invalid in INVALID_CHARS:
if r.name.find(invalid) :
r.name=r.name.replace(invalid,INVALID_CHARS[invalid])
result2 = map(lambda x: node_class(self.cr, self.uid, self.path+'/'+x.name.replace('/','__'), self.object, x, root=x.id), res)
if result2:
result = result2
if self.object.ressource_tree:
result += result2
else:
result = result2
return result
def children(self):
@@ -311,12 +326,12 @@ class document_directory(osv.osv):
object: the object.directory or object.directory.content
object2: the other object linked (if object.directory.content)
"""
def get_object(self, cr, uid, uri, context={}):
def get_object(self, cr, uid, uri, context={}):
if not uri:
return node_class(cr, uid, '', False, type='database')
turi = tuple(uri)
if False and (turi in self._cache):
(path, oo, oo2, content,type,root) = self._cache[turi]
if False and (turi in self._cache):
(path, oo, oo2, content,type,root) = self._cache[turi]
if oo:
object = self.pool.get(oo[0]).browse(cr, uid, oo[1], context)
else:
+24 -10
View File
@@ -35,13 +35,13 @@ def _get_month_name(month):
def _to_unicode(s):
try:
return s.encode('ascii')
return s.decode('utf-8')
except UnicodeError:
try:
return s.decode('utf-8')
return s.decode('latin')
except UnicodeError:
try:
return s.decode('latin')
return s.encode('ascii')
except UnicodeError:
return s
@@ -135,6 +135,11 @@ class abstracted_fs:
res = cr.fetchone()
if res and len(res):
self.db_name_list.append(db_name)
cr.commit()
except Exception,e:
log(e)
if cr:
cr.rollback()
finally:
if cr is not None:
cr.close()
@@ -184,10 +189,11 @@ class abstracted_fs:
def ftp2fs(self, path_orig, data):
path = self.ftpnorm(path_orig)
if path and path=='/':
return None
path=_to_unicode(path)
return None
path2 = filter(None,path.split('/'))[1:]
(cr, uid, pool) = data
if len(path2):
path2[-1]=_to_unicode(path2[-1])
res = pool.get('document.directory').get_object(cr, uid, path2[:])
if not res:
raise OSError(2, 'Not such file or directory.')
@@ -195,7 +201,15 @@ class abstracted_fs:
# Ok
def fs2ftp(self, node):
res = node and ('/' + node.cr.dbname + '/' + _to_decode(node.path)) or '/'
res='/'
if node:
res=os.path.normpath(node.path)
res = res.replace("\\", "/")
while res[:2] == '//':
res = res[1:]
res='/' + node.cr.dbname + '/' + _to_decode(res)
#res = node and ('/' + node.cr.dbname + '/' + _to_decode(self.ftpnorm(node.path))) or '/'
return res
# Ok
@@ -274,7 +288,7 @@ class abstracted_fs:
s = file_wrapper('', cid, cr.dbname, uid, )
return s
except Exception,e:
except Exception,e:
log(e)
raise OSError(1, 'Operation not permited.')
@@ -337,7 +351,7 @@ class abstracted_fs:
# Ok
def chdir(self, path):
def chdir(self, path):
if not path:
self.cwd='/'
return None
@@ -737,8 +751,8 @@ class abstracted_fs:
except ValueError:
mname=_get_month_name(time.strftime("%m"))
mtime = mname+' '+time.strftime("%d %H:%M")
# formatting is matched with proftpd ls output
path=_to_decode(file.path) #file.path.encode('ascii','replace').replace('?','_')
# formatting is matched with proftpd ls output
path=_to_decode(file.path) #file.path.encode('ascii','replace').replace('?','_')
yield "%s %3s %-8s %-8s %8s %s %s\r\n" %(perms, nlinks, uname, gname,
size, mtime, path.split('/')[-1])
-2
View File
@@ -283,7 +283,6 @@ class hr_holidays(osv.osv):
return True
hr_holidays()
<<<<<<< TREE
class hr_holidays_per_user(osv.osv):
_name = "hr.holidays.per.user"
@@ -344,4 +343,3 @@ class holiday_user_log(osv.osv):
'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
}
holiday_user_log()