This commit is contained in:
younes 2025-08-07 12:29:23 +01:00
parent a3f4926a44
commit c70e2e05e2
2 changed files with 7 additions and 7 deletions

View File

@ -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

View File

@ -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',