diff options
| author | Jay (Open ERP) <jvo@tinyerp.com> | 2009-08-27 19:49:22 +0530 |
|---|---|---|
| committer | Jay (Open ERP) <jvo@tinyerp.com> | 2009-08-27 19:49:22 +0530 |
| commit | ce0c60e15212e595354e35cb0b1ae9ce652b46db (patch) | |
| tree | c616380e5652b50ebaa628f657920dabf133810d | |
| parent | 20a0acd6cfaba4317a4c5051f7f79d3667acfc67 (diff) | |
[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
| -rw-r--r-- | bin/osv/fields.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/bin/osv/fields.py b/bin/osv/fields.py index ee235e95eca..dbd37ec8a76 100644 --- a/bin/osv/fields.py +++ b/bin/osv/fields.py @@ -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())) |
