get_binary_size is renamed bin_size and its behavior is reversed (False by default)
bzr revid: christophe@tinyerp.com-20080923104745-m5osg61ukqtk0szi
This commit is contained in:
parent
17eb1ec7da
commit
500e964ebb
|
@ -223,7 +223,7 @@ class binary(_column):
|
|||
val = v[name]
|
||||
break
|
||||
res.setdefault(i, val)
|
||||
if context.get('get_binary_size', True):
|
||||
if context.get('bin_size', False):
|
||||
res[i] = tools.human_size(val)
|
||||
|
||||
return res
|
||||
|
@ -620,7 +620,7 @@ class function(_column):
|
|||
else:
|
||||
res = self._fnct(cr, obj._table, ids, name, self._arg, context)
|
||||
|
||||
if self._type == 'binary' and context.get('get_binary_size', True):
|
||||
if self._type == 'binary' and context.get('bin_size', False):
|
||||
# convert the data returned by the function with the size of that data...
|
||||
res = dict(map(lambda (x, y): (x, tools.human_size(len(y))), res.items()))
|
||||
return res
|
||||
|
|
|
@ -1127,7 +1127,7 @@ class orm_memory(orm_template):
|
|||
for f in fields_to_read:
|
||||
if id in self.datas:
|
||||
r[f] = self.datas[id].get(f, False)
|
||||
if r[f] and isinstance(self._columns[f], fields.binary) and context.get('get_binary_size', True):
|
||||
if r[f] and isinstance(self._columns[f], fields.binary) and context.get('bin_size', False):
|
||||
r[f] = len(r[f])
|
||||
result.append(r)
|
||||
if id in self.datas:
|
||||
|
@ -1721,7 +1721,7 @@ class orm(orm_template):
|
|||
def convert_field(f):
|
||||
if f in ('create_date', 'write_date'):
|
||||
return "date_trunc('second', %s) as %s" % (f, f)
|
||||
if isinstance(self._columns[f], fields.binary) and context.get('get_binary_size', True):
|
||||
if isinstance(self._columns[f], fields.binary) and context.get('bin_size', False):
|
||||
return "length(%s) as %s" % (f,f)
|
||||
return '"%s"' % (f,)
|
||||
#fields_pre2 = map(lambda x: (x in ('create_date', 'write_date')) and ('date_trunc(\'second\', '+x+') as '+x) or '"'+x+'"', fields_pre)
|
||||
|
|
|
@ -566,7 +566,6 @@ class report_sxw(report_rml):
|
|||
if not context:
|
||||
context={}
|
||||
context = context.copy()
|
||||
context['get_binary_size'] = False
|
||||
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
ir_actions_report_xml_obj = pool.get('ir.actions.report.xml')
|
||||
|
|
Loading…
Reference in New Issue