diff options
| author | Quentin (OpenERP) <qdp-launchpad@openerp.com> | 2013-04-24 11:28:10 +0200 |
|---|---|---|
| committer | Quentin (OpenERP) <qdp-launchpad@openerp.com> | 2013-04-24 11:28:10 +0200 |
| commit | c366f6becfd117a6ff8f6aa73f4d042ee30da390 (patch) | |
| tree | b9d8b7d0715a2fe1f2ac41497061ccad3a927bcb /addons | |
| parent | 2b89c192f2c76d103aa5bbad1bbc54760e0ae507 (diff) | |
| parent | b2e2d854f87f7fa73d698093d113a650ff58698f (diff) | |
[FIX] hr_timesheet: proper fix for previously reverted commit 9058. Don't return a default value for journal and product if the uid doesn't have read access on it
bzr revid: qdp-launchpad@openerp.com-20130424092810-qmkgr66pv770euv3
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/hr_timesheet/hr_timesheet.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/addons/hr_timesheet/hr_timesheet.py b/addons/hr_timesheet/hr_timesheet.py index 6a538e5d09c..0392cb4d6a2 100644 --- a/addons/hr_timesheet/hr_timesheet.py +++ b/addons/hr_timesheet/hr_timesheet.py @@ -37,8 +37,11 @@ class hr_employee(osv.osv): def _getAnalyticJournal(self, cr, uid, context=None): md = self.pool.get('ir.model.data') try: - result = md.get_object_reference(cr, uid, 'hr_timesheet', 'analytic_journal') - return result[1] + dummy, res_id = md.get_object_reference(cr, uid, 'hr_timesheet', 'analytic_journal') + #search on id found in result to check if current user has read access right + check_right = self.pool.get('account.analytic.journal').search(cr, uid, [('id', '=', res_id)], context=context) + if check_right: + return res_id except ValueError: pass return False @@ -46,8 +49,11 @@ class hr_employee(osv.osv): def _getEmployeeProduct(self, cr, uid, context=None): md = self.pool.get('ir.model.data') try: - result = md.get_object_reference(cr, uid, 'product', 'product_product_consultant') - return result[1] + dummy, res_id = md.get_object_reference(cr, uid, 'product', 'product_product_consultant') + #search on id found in result to check if current user has read access right + check_right = self.pool.get('product.template').search(cr, uid, [('id', '=', res_id)], context=context) + if check_right: + return res_id except ValueError: pass return False |
