diff --git a/odex25_hr/exp_payroll_custom/models/hr_advance_payslip.py b/odex25_hr/exp_payroll_custom/models/hr_advance_payslip.py index 5002e4c3a..de6332605 100644 --- a/odex25_hr/exp_payroll_custom/models/hr_advance_payslip.py +++ b/odex25_hr/exp_payroll_custom/models/hr_advance_payslip.py @@ -827,12 +827,6 @@ class SalaryRuleInput(models.Model): 'leave_request_case': True, 'amount': -amount }) - payslip.allowance_ids._compute_total() - payslip.deduction_ids._compute_total() - for pay in payslip: - if pay.total_sum < 0: - raise exceptions.Warning(_("Salary is less than 0 this month for the following employees \n %s") % ( - pay.employee_id.name)) lines = [(0, 0, line) for line in self._get_payslip_lines(contract_ids, payslip.id)] payslip.write({'line_ids': lines, 'number': number, 'level_id': payslip.contract_id.salary_level.id, @@ -888,6 +882,12 @@ class SalaryRuleInput(models.Model): loan.state = 'closed' payslip.loan_ids = [(0, 0, loan_item) for loan_item in payslip_loans] + payslip.allowance_ids._compute_total() + payslip.deduction_ids._compute_total() + for pay in payslip: + if pay.total_sum < 0: + raise exceptions.Warning(_("Salary is less than 0 this month for the following employees \n %s") % ( + pay.employee_id.name)) self.write({'state': 'computed'}) return True diff --git a/odex25_hr/hr_holidays_public/models/hr_holidays.py b/odex25_hr/hr_holidays_public/models/hr_holidays.py index 165a420f2..074a07b32 100644 --- a/odex25_hr/hr_holidays_public/models/hr_holidays.py +++ b/odex25_hr/hr_holidays_public/models/hr_holidays.py @@ -457,7 +457,7 @@ class HRHolidays(models.Model): _('Sorry The Employee %s Actually On Permission For this Period') % rec.employee_id.name) if rec.replace_by: - if not rec.canceled_duration: + if rec.state != 'validate1': holiday_dfrm = self.env['hr.holidays'].search( [('employee_id', '=', rec.replace_by.id), ('type', '=', 'remove'), ('state', '!=', 'refuse'), ('date_from', '<=', rec.date_from), ('date_to', '>=', rec.date_from)], order='id desc',