terminate emp there custody requests exceeded
This commit is contained in:
parent
c385ad766f
commit
6d1fe6622a
|
|
@ -2123,3 +2123,10 @@ msgid "Sorry, The Refuse For The Department Manager '%s' Only !"
|
|||
msgstr "للأسف، لرفض مدير الإدارة '%s' فقط او مدير الموارد البشرية !"
|
||||
|
||||
|
||||
#. module: hr_termination
|
||||
#: code:addons/hr_termination/models/hr_termination.py:0
|
||||
#, python-format
|
||||
msgid ""
|
||||
"You cannot terminate the employee \"%s\" because there are \"%s\" custody "
|
||||
"requests that exceeded the allowed amount and are not yet closed."
|
||||
msgstr "لا يمكن إنهاء خدمة الموظف \"%s\" حيث توجد \"%s\" عهد تجاوزت المبلغ المسموح ولم تُغلق بعد."
|
||||
|
|
|
|||
|
|
@ -220,8 +220,14 @@ class HrTermination(models.Model):
|
|||
def _compute_holiday_amount(self):
|
||||
for item in self:
|
||||
if item.salary:
|
||||
|
||||
days = item.employee_id.resource_calendar_id.work_days
|
||||
day_amount = item.salary / days
|
||||
if days:
|
||||
day_amount = item.salary / days
|
||||
else:
|
||||
day_amount = 5.0
|
||||
|
||||
# day_amount = item.salary / days
|
||||
holiday_amount = item.leave_balance * day_amount
|
||||
item.leave_balance_money = round(holiday_amount,2)
|
||||
|
||||
|
|
@ -786,6 +792,7 @@ class HrTermination(models.Model):
|
|||
emp_modules = Module.search([('state', '=', 'installed'), ('name', '=', 'exp_employee_custody')])
|
||||
petty_cash_modules = Module.search([('state', '=', 'installed'), ('name', '=', 'hr_expense_petty_cash')])
|
||||
asset_modules = Module.search([('state', '=', 'installed'), ('name', '=', 'odex25_account_asset')])
|
||||
custody_request_module = Module.search([('state', '=', 'installed'), ('name', '=', 'employee_custody_request')])
|
||||
|
||||
# modules = Module.search([('state', '=', 'installed'), ('name', '=', 'exp_custody_petty_cash')])
|
||||
''''if asset_modules:
|
||||
|
|
@ -817,6 +824,17 @@ class HrTermination(models.Model):
|
|||
_(
|
||||
'You can not create termination when there is "%s" employee petty cash payment in state not in state Return Done for "%s" please reconcile it') % (
|
||||
len(employee_petty_cash_payment), self.employee_id.name))
|
||||
if custody_request_module:
|
||||
print("lokokoko")
|
||||
exceeded_custody = self.env['hr.request.pledge'].search([
|
||||
('employee_id', '=', self.employee_id.id),
|
||||
('custody_status', '=', 'exceeded')
|
||||
])
|
||||
if exceeded_custody:
|
||||
raise exceptions.Warning(_(
|
||||
'You cannot terminate the employee "%s" because there are "%s" custody requests that exceeded the allowed amount and are not yet closed.'
|
||||
) % (self.employee_id.name, len(exceeded_custody)))
|
||||
|
||||
for item in self:
|
||||
# Check if Net less than 0.0
|
||||
if item.net < 0:
|
||||
|
|
|
|||
Loading…
Reference in New Issue