From 9f25a3dce39e1411acf7f5390cb4307c3af6ceac Mon Sep 17 00:00:00 2001 From: ced <> Date: Wed, 26 Sep 2007 05:20:18 +0000 Subject: [PATCH] Fix read function to work also with one id bzr revid: ced-230c81d48b489c89bde4cec43779ac3c61eb0a22 --- addons/hr/hr_department.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/addons/hr/hr_department.py b/addons/hr/hr_department.py index 0a73232f55b..558c949efd9 100644 --- a/addons/hr/hr_department.py +++ b/addons/hr/hr_department.py @@ -65,13 +65,23 @@ hr_department() class ir_action_window(osv.osv): _inherit = 'ir.actions.act_window' - def read(self, cr, uid, ids, *args, **kwargs): - res = super(ir_action_window, self).read(cr, uid, ids, *args, **kwargs) + + def read(self, cr, uid, ids, fields=None, context=None, + load='_classic_read'): + select = ids + if isinstance(ids, (int, long)): + select = [ids] + res = super(ir_action_window, self).read(cr, uid, select, fields=fields, + context=context, load=load) for r in res: mystring = 'department_users_get()' if mystring in (r.get('domain', '[]') or ''): - r['domain'] = r['domain'].replace(mystring, str(self.pool.get('hr.department')._get_members(cr, uid))) + r['domain'] = r['domain'].replace(mystring, str( + self.pool.get('hr.department')._get_members(cr, uid))) + if isinstance(ids, (int, long)): + return res[0] return res + ir_action_window()