This commit is contained in:
Bakry 2025-09-09 16:46:04 +03:00
parent f5d20fe9e3
commit 67583cd8a3
3 changed files with 16 additions and 0 deletions

View File

@ -1774,3 +1774,9 @@ msgstr "رقم الموظف"
msgid "My Requests"
msgstr "طلبـاتي"
#. module: hr_loans_salary_advance
#: code:addons/hr_loans_salary_advance/models/hr_loan_salary_advance.py:0
#, python-format
msgid "Sorry, This Loan Is Linked To The Payment Or Scheduling Loan."
msgstr "عفوآ, هذه القرض مرتبط بدفع وجدولة القروض."

View File

@ -184,6 +184,10 @@ class HrSalaryAdvance(models.Model):
def refused(self):
for item in self:
loan_suspension = self.env['hr.loan.payment.suspension'].search([('loan_id','=', item.id)], limit=1)
if item.id == loan_suspension.loan_id.id:
raise exceptions.Warning(_("Sorry, This Loan Is Linked To The Payment Or Scheduling Loan."))
for line in item.deduction_lines:
if line.paid is True:
raise exceptions.Warning(_('You can not Refuse Loan because Loan with Deduction in Salary'))
@ -206,6 +210,10 @@ class HrSalaryAdvance(models.Model):
def create_loan(self):
for item in self:
loan_suspension = self.env['hr.loan.payment.suspension'].search([('loan_id','=', item.id)], limit=1)
if item.id == loan_suspension.loan_id.id:
raise exceptions.Warning(_("Sorry, This Loan Is Linked To The Payment Or Scheduling Loan."))
if item.gm_propos_amount <=0:
raise exceptions.Warning(_("Sorry, Approved Amount Must Be Greater Than Zero"))

View File

@ -259,6 +259,8 @@ class HrLoanPaymentSuspension(models.Model):
for rec in self:
if rec.state != 'draft':
raise UserError(_('Sorry you cannot delete a document is not in draft state.'))
rec.suspend_ids.unlink()
suspension_false = self.env['hr.loan.installment.suspension'].search([('pay_suspend_id', '=', False)]).unlink()
return super(HrLoanPaymentSuspension, self).unlink()