Skip to content
Snippets Groups Projects
Commit bf99c212 authored by helly kapatel's avatar helly kapatel Committed by fw-bot
Browse files

[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: 6953620f
Signed-off-by: default avatarYannick Tivisse (yti) <yti@odoo.com>
parent 69319bba
Branches
Tags
No related merge requests found
......@@ -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,
});
});
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment