[FIX] hr_holidays: display correct number of timeoff on approval view.
When timeoff is 1 day or 0.5 days then it was not going to correctly display timeoff number on approval page due to momment. For 1 day leave the date_to and date_from as equal so momment diff will be 0 days and floating is off for diff so not display 0.5 for floating leave. even we enable floating it will display the wrong floating based on 24 hours instead of 8 working hours a day. so get the number_of_days from db and display on leave same as department leave summary. Task-2071031 closes odoo/odoo#39032 X-original-commit: 6953620f507990010c593a0d35d67c81f5b27e47 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
This commit is contained in:
@@ -103,7 +103,7 @@ odoo.define('hr_holidays.LeaveStatsWidget', function (require) {
|
||||
['holiday_type', '=', 'employee'],
|
||||
['date_from', '<=', month_date_to],
|
||||
['date_to', '>=', month_date_from]],
|
||||
['employee_id', 'date_from', 'date_to'],
|
||||
['employee_id', 'date_from', 'date_to', 'number_of_days'],
|
||||
],
|
||||
}).then(function (data) {
|
||||
var dateFormat = time.getLangDateFormat();
|
||||
@@ -112,7 +112,7 @@ odoo.define('hr_holidays.LeaveStatsWidget', function (require) {
|
||||
return _.extend(leave, {
|
||||
date_from: moment(leave.date_from).format(dateFormat),
|
||||
date_to: moment(leave.date_to).format(dateFormat),
|
||||
number_of_days: moment(leave.date_to).diff(moment(leave.date_from), 'days'),
|
||||
number_of_days: leave.number_of_days,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user