From c636fb9dd9be1a70ac9da63b218078c9cff6c704 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Thu, 8 May 2014 14:49:46 +0200 Subject: [PATCH] [FIX] hr_holidays: better display of leave counter (opw 605016) The number of leave requests left is based on the employee_id key in the context, when displaying the status of an hr.holidays we don't have the information in the name_get of the hr.holidays.status. The fallback on the number of employees is done with the uid but we can not rely on it as well as the name_get on m2o field is done with superuser_id. bzr revid: mat@openerp.com-20140508124946-ttyr84iajg9q6l0y --- addons/hr_holidays/hr_holidays.py | 5 +++++ addons/hr_holidays/hr_holidays_view.xml | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/addons/hr_holidays/hr_holidays.py b/addons/hr_holidays/hr_holidays.py index c01e4cee46d..07d4995998a 100644 --- a/addons/hr_holidays/hr_holidays.py +++ b/addons/hr_holidays/hr_holidays.py @@ -95,6 +95,11 @@ class hr_holidays_status(osv.osv): def name_get(self, cr, uid, ids, context=None): if not ids: return [] + + if not context.get('employee_id',False): + # leave counts is based on empoyee_id, would be inaccurate if not based on correct employee + return super(hr_holidays_status, self).name_get(cr, uid, ids, context=context) + res = [] for record in self.browse(cr, uid, ids, context=context): name = record.name diff --git a/addons/hr_holidays/hr_holidays_view.xml b/addons/hr_holidays/hr_holidays_view.xml index 8277436b3e9..c39adcb3182 100644 --- a/addons/hr_holidays/hr_holidays_view.xml +++ b/addons/hr_holidays/hr_holidays_view.xml @@ -78,7 +78,7 @@ - + @@ -116,7 +116,7 @@ - +