[FIX] Functional fields with M2O relation can be printed on print screen now

lp bug: https://launchpad.net/bugs/415391 fixed

bzr revid: jvo@tinyerp.com-20090827141922-aapmtmc50y168jun
This commit is contained in:
Jay (Open ERP)
2009-08-27 19:49:22 +05:30
parent 20a0acd6cf
commit ce0c60e152
+11
View File
@@ -641,6 +641,17 @@ class function(_column):
else:
res = self._fnct(cr, obj._table, ids, name, self._arg, context)
if self._type == "many2one" :
# Filtering only integer/long values if passed
res_ids = [x for x in res.values() if x and isinstance(x, (int,long))]
if res_ids:
obj_model = obj.pool.get(self._obj)
dict_names = dict(obj_model.name_get(cr, user, res_ids, context))
for r in res.keys():
if res[r] and res[r] in dict_names:
res[r] = (res[r], dict_names[res[r]])
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 or ''))), res.items()))