Merge pull request #186 from expsa/abuzar_task_hr

fix loan
This commit is contained in:
AbuzarExp 2024-07-14 13:34:11 +03:00 committed by GitHub
commit b8f07b1542
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 0 deletions

View File

@ -100,13 +100,16 @@ class HrSalaryAdvance(models.Model):
def submit(self):
for item in self:
if item.employee_id.state != 'open':
raise exceptions.Warning(_('You Can Not Submit Loan where Employee %s Not In Service')
% item.employee_id.name)
item.create_loan()
if item.request_type.year > (item.months_employeed / 12):
raise exceptions.Warning(_('You can not submit loan when your total service is less than number '
'of years'))
deductions = item.deduction_lines
# if len(deductions) == 0:
# raise exceptions.Warning(_('You must create al least one installment'))
if len(deductions) != item.months: