diff options
| author | Thibault Delavallée <tde@openerp.com> | 2014-11-14 10:46:57 +0100 |
|---|---|---|
| committer | Thibault Delavallée <tde@openerp.com> | 2014-11-14 10:46:57 +0100 |
| commit | e06e35d2d37a03b157b73a332b4c5062198b4c5b (patch) | |
| tree | a4d5dc9b03bab749a04fd6599be42d4c0529435f /addons | |
| parent | 5d74994eb21ab977286daff1ed1de2f48523d6df (diff) | |
[FIX] hr_holidays: fix virtual remaining leaves computation.
Now only validated allocation requests are taken into account
when computing the number of virtual remaining leaves (leaves
+ pending leaves). This avoid creating allocation request to
have virtual remaining leaves artificially added.
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/hr_holidays/hr_holidays.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/addons/hr_holidays/hr_holidays.py b/addons/hr_holidays/hr_holidays.py index 507667a930f..4c190a69800 100644 --- a/addons/hr_holidays/hr_holidays.py +++ b/addons/hr_holidays/hr_holidays.py @@ -49,8 +49,11 @@ class hr_holidays_status(osv.osv): for holiday in self.pool['hr.holidays'].browse(cr, uid, holiday_ids, context=context): status_dict = result[holiday.holiday_status_id.id] if holiday.type == 'add': - status_dict['virtual_remaining_leaves'] += holiday.number_of_days if holiday.state == 'validate': + # note: add only validated allocation even for the virtual + # count; otherwise pending then refused allocation allow + # the employee to create more leaves than possible + status_dict['virtual_remaining_leaves'] += holiday.number_of_days status_dict['max_leaves'] += holiday.number_of_days status_dict['remaining_leaves'] += holiday.number_of_days elif holiday.type == 'remove': # number of days is negative |
