[FIX] hr_permission_holidays: fix domain and onchange function to use permission type
This commit is contained in:
parent
93a563019c
commit
62060e877a
|
|
@ -23,6 +23,7 @@ class HrPersonalPermission(models.Model):
|
|||
date_to = current_date.strftime('%Y-{0}-31'.format(current_month))
|
||||
employee_permissions = self.search([
|
||||
('employee_id', '=', self.employee_id.id),
|
||||
('permission_type_id', '=', self.permission_type_id.id),
|
||||
('state', '=', 'approve'),
|
||||
('date_from', '>=', date_from),
|
||||
('date_to', '<=', date_to)])
|
||||
|
|
@ -43,7 +44,7 @@ class HrPersonalPermission(models.Model):
|
|||
rec.permission_number = round(permission_type_id.monthly_hours - all_perission, 2)
|
||||
|
||||
# @api.onchange('date_to', 'date_from', 'employee_id','deduct_from_holiday')
|
||||
@api.constrains('date_to', 'date_from', 'employee_id', 'deduct_from_holiday')
|
||||
@api.constrains('date_to', 'date_from', 'employee_id', 'permission_type_id', 'deduct_from_holiday')
|
||||
def permission_number_decrement(self):
|
||||
for rec in self:
|
||||
if not rec.employee_id.first_hiring_date:
|
||||
|
|
|
|||
Loading…
Reference in New Issue