From 6d9ae761cdc5b5b4599c0fbe1a63265f930ff8b9 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Tue, 23 Apr 2013 14:28:20 +0200 Subject: [PATCH] [FIX] hr_timesheet: return default values for journal and product only if the uid has the read access on it (multi-company) thanks to a new method on ir.model.data: check_object_reference() bzr revid: qdp-launchpad@openerp.com-20130423122820-9gf2i4iic5bqr8g6 --- addons/hr_timesheet/hr_timesheet.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/hr_timesheet/hr_timesheet.py b/addons/hr_timesheet/hr_timesheet.py index 6a538e5d09c..461507f9e41 100644 --- a/addons/hr_timesheet/hr_timesheet.py +++ b/addons/hr_timesheet/hr_timesheet.py @@ -37,8 +37,8 @@ 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.check_object_reference(cr, uid, 'hr_timesheet', 'analytic_journal') + return res_id except ValueError: pass return False @@ -46,8 +46,8 @@ 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.check_object_reference(cr, uid, 'product', 'product_product_consultant') + return res_id except ValueError: pass return False