From 4ee0d18712c7321a438dd5ed2f5951d2dbe7f09d Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Fri, 9 Jun 2017 13:09:37 +0200 Subject: [PATCH] FIX hr_holidays_usability use float_compare --- hr_holidays_usability/hr_holidays.py | 4 +++- hr_holidays_usability/hr_holidays_view.xml | 17 +++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/hr_holidays_usability/hr_holidays.py b/hr_holidays_usability/hr_holidays.py index db1022e..5e37adc 100644 --- a/hr_holidays_usability/hr_holidays.py +++ b/hr_holidays_usability/hr_holidays.py @@ -24,6 +24,7 @@ from openerp.osv import orm, fields from openerp.tools.translate import _ from openerp.tools import DEFAULT_SERVER_DATE_FORMAT, \ DEFAULT_SERVER_DATETIME_FORMAT +from openerp.tools import float_compare from datetime import datetime from dateutil.relativedelta import relativedelta import pytz @@ -345,7 +346,8 @@ class HrHolidays(orm.Model): False)[record.holiday_status_id.id]['remaining_leaves'] # here is the code that I modify #if leaves_rest < record.number_of_days_temp: - if leaves_rest < record.number_of_days * -1: + #if leaves_rest < record.number_of_days * -1: + if float_compare(leaves_rest, record.number_of_days * -1, precision_digits=2) < 0: raise orm.except_orm( _('Warning!'), _('There are not enough %s allocated for ' diff --git a/hr_holidays_usability/hr_holidays_view.xml b/hr_holidays_usability/hr_holidays_view.xml index 36f7dbc..b0c5a29 100644 --- a/hr_holidays_usability/hr_holidays_view.xml +++ b/hr_holidays_usability/hr_holidays_view.xml @@ -180,12 +180,25 @@ This menu entry is designed for this and only accessible to HR Manager --> Leave Requests Force Qty hr.holidays - form - + tree,form {'default_type': 'remove'} [('type','=','remove')] + + + tree + + + + + + + form + + + +