commit
eb56b8605e
|
|
@ -2989,3 +2989,16 @@ msgstr "الحساب التحليلي"
|
|||
#: code:addons/exp_payroll_custom/models/hr_advance_payslip.py:0
|
||||
msgid "Sorry The Contract Employee %s is Not Journal Set"
|
||||
msgstr "للأسف، لم يتم اعداد دفتر اليومية لعقد الموظف %s."
|
||||
|
||||
#. module: exp_payroll_custom
|
||||
#: model:ir.model.fields,field_description:exp_payroll_custom.field_hr_payslip_line__reduce_with_leaves
|
||||
#: model:ir.model.fields,field_description:exp_payroll_custom.field_hr_salary_rule__reduce_with_leaves
|
||||
msgid "Reduce With Leaves"
|
||||
msgstr "تخفيض البدل بسبب الإجازات"
|
||||
|
||||
#. module: exp_payroll_custom
|
||||
#: model:ir.model.fields,field_description:exp_payroll_custom.field_hr_payslip_line__min_leave_days_to_deduct
|
||||
#: model:ir.model.fields,field_description:exp_payroll_custom.field_hr_salary_rule__min_leave_days_to_deduct
|
||||
msgid "Min Leave Days To Deduct"
|
||||
msgstr "الحد الأدنى لأيام الإجازة لتطبيق الخصم"
|
||||
|
||||
|
|
|
|||
|
|
@ -2208,6 +2208,7 @@ class HrPayslipLine(models.Model):
|
|||
if line.slip_id.worked_days_line_ids:
|
||||
total_days = 0
|
||||
per = 0
|
||||
days_number = sum(line.number_of_days for line in line.slip_id.worked_days_line_ids)
|
||||
for wo in line.slip_id.worked_days_line_ids:
|
||||
|
||||
####################################################### Holidays Unpaid ######################################
|
||||
|
|
@ -2222,7 +2223,8 @@ class HrPayslipLine(models.Model):
|
|||
else:
|
||||
total_days_after_holiday = 30 - work_days
|
||||
total_days = total_days_after_holiday
|
||||
if line.salary_rule_id.special == False:
|
||||
|
||||
if line.salary_rule_id.reduce_with_leaves == True and line.salary_rule_id.min_leave_days_to_deduct <= days_number:
|
||||
line.total = round(((line.amount / 30) * total_days_after_holiday) * line.percentage / 100,2)
|
||||
else:
|
||||
line.total = round(((line.amount) * line.percentage / 100),2)
|
||||
|
|
@ -2243,7 +2245,7 @@ class HrPayslipLine(models.Model):
|
|||
allow = (line.amount / 30) * work_days
|
||||
per += (allow * percentage / 100)
|
||||
actual_allow_tot = (line.amount / 30) * total_days_after_holiday
|
||||
if line.salary_rule_id.special == False:
|
||||
if line.salary_rule_id.reduce_with_leaves == True and line.salary_rule_id.min_leave_days_to_deduct <= days_number:
|
||||
line.total = round((actual_allow_tot + per) * line.percentage / 100,2)
|
||||
else:
|
||||
line.total = round(((line.amount) * line.percentage / 100),2)
|
||||
|
|
@ -2261,7 +2263,7 @@ class HrPayslipLine(models.Model):
|
|||
else:
|
||||
total_days_after_holiday = 30 - work_days
|
||||
total_days = total_days_after_holiday
|
||||
if line.leave_request_case or line.salary_rule_id.special == True:
|
||||
if line.leave_request_case or line.salary_rule_id.reduce_with_leaves == False or line.salary_rule_id.min_leave_days_to_deduct > days_number:
|
||||
line.total = round((line.amount) * line.percentage / 100,2)
|
||||
else:
|
||||
line.total = round(((line.amount / 30) * total_days_after_holiday) * line.percentage / 100,2)
|
||||
|
|
@ -2277,7 +2279,7 @@ class HrPayslipLine(models.Model):
|
|||
else:
|
||||
total_days_after_holiday = 30 - work_days
|
||||
total_days = total_days_after_holiday
|
||||
if not line.leave_request_case or line.salary_rule_id.special == True:
|
||||
if not line.leave_request_case or line.salary_rule_id.reduce_with_leaves == False or line.salary_rule_id.min_leave_days_to_deduct > days_number:
|
||||
line.total = round((line.amount) * line.percentage / 100,2)
|
||||
else:
|
||||
line.total = round(((line.amount / 30) * total_days_after_holiday) * line.percentage / 100,2)
|
||||
|
|
@ -2285,7 +2287,7 @@ class HrPayslipLine(models.Model):
|
|||
else:
|
||||
work_days = wo.number_of_days
|
||||
total_days = work_days
|
||||
if line.leave_request_case or line.salary_rule_id.special == True:
|
||||
if line.leave_request_case or line.salary_rule_id.reduce_with_leaves == False or line.salary_rule_id.min_leave_days_to_deduct > days_number:
|
||||
line.total = round((line.amount) * line.percentage / 100,2)
|
||||
else:
|
||||
line.total = round(((line.amount / 30) * work_days) * line.percentage / 100,2)
|
||||
|
|
|
|||
|
|
@ -128,10 +128,17 @@ class HrContractSalaryScale(models.Model):
|
|||
total_ded = 0
|
||||
for line in rule_ids:
|
||||
if line.category_id.rule_type == 'allowance':
|
||||
total_allowance += line._compute_rule(localdict)[0]
|
||||
try:
|
||||
total_allowance += line._compute_rule(localdict)[0]
|
||||
except:
|
||||
total_allowance += 0
|
||||
|
||||
if line.category_id.rule_type == 'deduction':
|
||||
total_ded += line._compute_rule(localdict)[0]
|
||||
try:
|
||||
total_ded += line._compute_rule(localdict)[0]
|
||||
except:
|
||||
total_ded += 0
|
||||
|
||||
|
||||
if line.rules_type == 'house':
|
||||
item.house_allowance_temp += line._compute_rule(localdict)[0]
|
||||
|
|
@ -146,9 +153,15 @@ class HrContractSalaryScale(models.Model):
|
|||
total_deduction = 0
|
||||
for line in level_rule_ids:
|
||||
if line.category_id.rule_type == 'allowance':
|
||||
total_allowance += line._compute_rule(localdict)[0]
|
||||
try:
|
||||
total_allowance += line._compute_rule(localdict)[0]
|
||||
except:
|
||||
total_allowance += 0
|
||||
elif line.category_id.rule_type == 'deduction':
|
||||
total_deduction += line._compute_rule(localdict)[0]
|
||||
try:
|
||||
total_deduction += line._compute_rule(localdict)[0]
|
||||
except:
|
||||
total_deduction += 0
|
||||
|
||||
item.total_allowance += total_allowance
|
||||
item.total_deduction += -total_deduction
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@ class HrSalaryRules(models.Model):
|
|||
string='Type Scale')
|
||||
related_qualifications = fields.Boolean(string='Related with qualifications')
|
||||
special = fields.Boolean(string='Special')
|
||||
reduce_with_leaves = fields.Boolean(string='Reduce With Leaves',default=True)
|
||||
min_leave_days_to_deduct = fields.Integer(string='Min Leave Days To Deduct')
|
||||
company_id = fields.Many2one(comodel_name='res.company', string='Company', required=True,
|
||||
default=lambda self: self.env.user.company_id)
|
||||
discount_absence = fields.Selection([('by_day', _('By Day')),
|
||||
|
|
|
|||
|
|
@ -49,6 +49,8 @@
|
|||
<group>
|
||||
<field name="special"/>
|
||||
<field name="rules_type" required="1"/>
|
||||
<field name="reduce_with_leaves"/>
|
||||
<field name="min_leave_days_to_deduct" attrs="{'invisible':[('reduce_with_leaves','=',False)]}"/>
|
||||
<!--field name="related_qualifications"/-->
|
||||
</group>
|
||||
</group>
|
||||
|
|
|
|||
|
|
@ -637,7 +637,7 @@ class HrEmployee(models.Model):
|
|||
raise ValidationError(
|
||||
_("You cannot create Employee with the same employee number")
|
||||
)
|
||||
if item.birthday >= date.today():
|
||||
if item.birthday and isinstance(item.birthday, date) and item.birthday >= date.today():
|
||||
raise Warning(_("Sorry,The Birthday Must Be Less than Date Today"))
|
||||
if item.attachment_ids:
|
||||
for rec in item.attachment_ids:
|
||||
|
|
|
|||
|
|
@ -457,23 +457,24 @@ class HRHolidays(models.Model):
|
|||
_('Sorry The Employee %s Actually On Permission For this Period') % rec.employee_id.name)
|
||||
|
||||
if rec.replace_by:
|
||||
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',
|
||||
limit=1)
|
||||
if not rec.canceled_duration:
|
||||
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',
|
||||
limit=1)
|
||||
|
||||
holiday_dto = self.env['hr.holidays'].search(
|
||||
[('employee_id', '=', rec.replace_by.id), ('type', '=', 'remove'), ('state', '!=', 'refuse'),
|
||||
('date_from', '<=', rec.date_to), ('date_to', '>=', rec.date_to)], order='id desc', limit=1)
|
||||
holiday_dto = self.env['hr.holidays'].search(
|
||||
[('employee_id', '=', rec.replace_by.id), ('type', '=', 'remove'), ('state', '!=', 'refuse'),
|
||||
('date_from', '<=', rec.date_to), ('date_to', '>=', rec.date_to)], order='id desc', limit=1)
|
||||
|
||||
holiday_btw = self.env['hr.holidays'].search(
|
||||
[('employee_id', '=', rec.replace_by.id), ('type', '=', 'remove'), ('state', '!=', 'refuse'),
|
||||
('date_from', '>=', rec.date_from), ('date_from', '<=', rec.date_to)], order='id desc',
|
||||
limit=1)
|
||||
holiday_btw = self.env['hr.holidays'].search(
|
||||
[('employee_id', '=', rec.replace_by.id), ('type', '=', 'remove'), ('state', '!=', 'refuse'),
|
||||
('date_from', '>=', rec.date_from), ('date_from', '<=', rec.date_to)], order='id desc',
|
||||
limit=1)
|
||||
|
||||
if holiday_dfrm or holiday_dto or holiday_btw:
|
||||
raise exceptions.Warning(
|
||||
_('Sorry The Replacement Employee %s Actually On Holiday For this Period') % rec.replace_by.name)
|
||||
if holiday_dfrm or holiday_dto or holiday_btw:
|
||||
raise exceptions.Warning(
|
||||
_('Sorry The Replacement Employee %s Actually On Holiday For this Period') % rec.replace_by.name)
|
||||
rec.delegate_acc = True
|
||||
else:
|
||||
rec.delegate_acc = False
|
||||
|
|
|
|||
Loading…
Reference in New Issue