This commit is contained in:
odex 2024-07-14 13:33:27 +03:00
parent c064432038
commit abb0831fac
1 changed files with 3 additions and 0 deletions

View File

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