Skip to Content
Menu
This question has been flagged

Hi,


I need to count all days in Leave request.

using v13 community edition.

Please advise any solution or suggest any module

Avatar
Discard
Best Answer

Hi,
If you are looking to include the leave days in the time off request, you need to modify the function _get_number_of_days in the model hr.leave .

Inherit the model and rewrite the corresponding function like this, and make sure it will not make error in other existing functionalities.

from odoo.addons.resource.models.resource import float_to_time, HOURS_PER_DAY


class HolidaysRequest(models.Model):
_inherit = "hr.leave"

def _get_number_of_days(self, date_from, date_to, employee_id):
days = (date_to - date_from).days
return {'days': days, 'hours': HOURS_PER_DAY * days}



Thanks

Avatar
Discard
Author

Thank you Niyas Raphy

Related Posts Replies Views Activity
1
Jan 24
7690
0
Mar 21
975
1
Aug 24
13206
2
Jan 23
4101
0
Jul 22
1899