it seems that leaves can be requested in days only. if, using date from/to fields on the leave request form, i select 4 hours, openerp counts always 1 day.
is it possible to change this behaviour? are you aware of 3rd party addons that modify this and allow to specify hours instead of days?
menu settings/configuration/sales check box to True for "Allow using different units of measures" and apply
now, in menu sales/configuration you will have a new section "units of measure".
click on this section and you will have days and hours as "working time category".
days is the unit of reference, and hours lower than the unit of reference (warning, just configure one unit of reference by category, there was a bug with this in 6.0, but now ???)
then to compare unit of reference and other (smaller or biggert than unit of reference), use ratio value.
I'm looking hr holidays code, the problem comes from 2 functions onchange_date_from and onchange_date_to.
In the first if you add value only in date_from, value returned is 8 hours, with working time unit of measure this will correspond to one day (see the ratio days/hours).
if there is date_from and date_to, this will return :
diff_day = self._get_number_of_days(date_from, date_to) result['value']['number_of_days_temp'] = round(math.floor(diff_day))+1
here round will convert float to integer with 0 as result for 4 hours, that's why it is add + 1 after round function. This is strange because number_of days has type float ...
I think this is an error ....
Update 2 :
solution here could be, but to test result (not done), by adding 2 decimals to the result :
result['value']['number_of_days_temp'] = round(math.floor(diff_day), 2)
perhaps verify the rest of the code too and just add filter cases for 1/4 day, 1/2 day, 3/4 day.
Hoping that solves your problem.
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 3/7/13, 8:35 AM|
|Seen: 1769 times|
|Last updated: 3/16/15, 8:10 AM|