[ADD]hr_negative_leave
This commit is contained in:
16
hr_negative_leave/models/hr_leave.py
Normal file
16
hr_negative_leave/models/hr_leave.py
Normal file
@@ -0,0 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
# Copyright (c) 2005-2006 Axelor SARL. (http://www.axelor.com)
|
||||
|
||||
from odoo import api, models
|
||||
|
||||
class HrLeave(models.Model):
|
||||
_inherit = "hr.leave"
|
||||
|
||||
@api.constrains('state', 'number_of_days', 'holiday_status_id')
|
||||
def _check_holidays(self):
|
||||
# Keep only leaves that do not allow negative balances
|
||||
to_check = self.filtered(lambda h: not h.holiday_status_id.allows_negative)
|
||||
if to_check:
|
||||
super(HrLeave, to_check)._check_holidays()
|
||||
Reference in New Issue
Block a user