From 4b4671f5e0a3d44e9fd4f8b2b724da47d1cae335 Mon Sep 17 00:00:00 2001 From: "Rucha (Open ERP)" Date: Thu, 10 Mar 2011 18:48:27 +0530 Subject: [PATCH] [IMP]: hr: All users must have "Employees" in their shortcuts bzr revid: rpa@tinyerp.com-20110310131827-xbm0r2edcivfhr61 --- addons/hr/hr.py | 24 +++++++++++++++++++++++- addons/hr/hr_view.xml | 7 +++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/addons/hr/hr.py b/addons/hr/hr.py index 3307a11ac18..d93c1ae3986 100644 --- a/addons/hr/hr.py +++ b/addons/hr/hr.py @@ -20,7 +20,7 @@ ############################################################################## from osv import fields, osv - +import logging import addons class hr_employee_category(osv.osv): @@ -220,4 +220,26 @@ class hr_department(osv.osv): hr_department() + +class res_users(osv.osv): + _name = 'res.users' + _inherit = 'res.users' + + def create(self, cr, uid, data, context=None): + user_id = super(res_users, self).create(cr, uid, data, context=context) + data_obj = self.pool.get('ir.model.data') + try: + data_id = data_obj._get_id(cr, uid, 'hr', 'ir_ui_view_sc_employee') + view_id = data_obj.browse(cr, uid, data_id, context=context).res_id + self.pool.get('ir.ui.view_sc').copy(cr, uid, view_id, default = { + 'user_id': user_id}, context=context) + except: + # Tolerate a missing shortcut. See product/product.py for similar code. + logging.getLogger('orm').debug('Skipped meetings shortcut for user "%s"', data.get('name',' + + Employees + ir.ui.menu + + + +