fix(hr_termination): Task 12230
Fix plus et minus five years amount. Signed-off-by: FathiaBMExp <f.mohamed@exp-sa.com>
This commit is contained in:
parent
abe3a5d837
commit
2b11b64860
|
|
@ -344,7 +344,11 @@ class ReportTerminationPublic(models.AbstractModel):
|
|||
if rule.id == item.get('salary_rule_id') and rule.category_id.rule_type == 'deduction':
|
||||
total -= item.get('amount')
|
||||
salary_for_eos += total
|
||||
|
||||
leave_balance = 0
|
||||
leave_balance_money = 0
|
||||
cause_type_amount = 0
|
||||
minus_five_years_amount = 0
|
||||
plus_five_years_amount = 0
|
||||
# Get salary rule form cause type
|
||||
if first_hire_date and last_work_date and cause_type_id:
|
||||
start_date = dt.strptime(str(first_hire_date), "%Y-%m-%d")
|
||||
|
|
@ -387,14 +391,21 @@ class ReportTerminationPublic(models.AbstractModel):
|
|||
if line.date_to <= all_duration:
|
||||
if line.amount > 0:
|
||||
duration_to = line.date_to - duration_to
|
||||
reward_amount += total_rules * (duration_to / 12) * line.factor
|
||||
termination_amount = total_rules * (duration_to / 12) * line.factor
|
||||
reward_amount += termination_amount
|
||||
resedual = all_duration - line.date_to
|
||||
|
||||
if line.date_to <= 60:
|
||||
minus_five_years_amount += termination_amount
|
||||
else:
|
||||
plus_five_years_amount += termination_amount
|
||||
else:
|
||||
if line.date_to > all_duration:
|
||||
reward_amount += total_rules * resedual / 12 * line.factor
|
||||
break
|
||||
resedual = 0
|
||||
termination_amount = total_rules * resedual / 12 * line.factor
|
||||
reward_amount += termination_amount
|
||||
if line.date_to <= 60:
|
||||
minus_five_years_amount += termination_amount
|
||||
else:
|
||||
plus_five_years_amount += termination_amount
|
||||
break
|
||||
reward_amount = reward_amount * line_amount
|
||||
cause_type_amount = round(reward_amount, 2)
|
||||
amount = self.compute_salary_rule(last_work_date, cause_type_amount, employee, cause_type_id.allowance_id, items,
|
||||
|
|
@ -467,6 +478,8 @@ class ReportTerminationPublic(models.AbstractModel):
|
|||
"total_loans": total_loans,
|
||||
"net": net,
|
||||
"cause_type_amount": cause_type_amount,
|
||||
"minus_five_years_amount": minus_five_years_amount,
|
||||
"plus_five_years_amount": plus_five_years_amount,
|
||||
}
|
||||
|
||||
def get_duration_service(self, first_hire_date, end_date):
|
||||
|
|
@ -598,6 +611,8 @@ class ReportTerminationPublic(models.AbstractModel):
|
|||
total_allowance = result["total_allowance"]
|
||||
total_loans = result["total_loans"]
|
||||
net = result["net"]
|
||||
plus_five_years_amount = result["plus_five_years_amount"]
|
||||
minus_five_years_amount = result["minus_five_years_amount"]
|
||||
cause_type_amount = result["cause_type_amount"]
|
||||
leave_balance = result["leave_balance"]
|
||||
leave_balance_money = result["leave_balance_money"]
|
||||
|
|
@ -609,9 +624,9 @@ class ReportTerminationPublic(models.AbstractModel):
|
|||
'ticket': ticket_num,
|
||||
'ticket_price': ticket_price,
|
||||
'leave_price': leave_balance_money,
|
||||
'termination_price': net,
|
||||
'five_year_price': cause_type_amount,
|
||||
'amount': cause_type_amount,
|
||||
'termination_price': cause_type_amount,
|
||||
'five_year_price': minus_five_years_amount,
|
||||
'amount': plus_five_years_amount,
|
||||
'total': total_allowance,
|
||||
'total_salary': 0.0,
|
||||
'rule': '',
|
||||
|
|
@ -619,7 +634,6 @@ class ReportTerminationPublic(models.AbstractModel):
|
|||
|
||||
}
|
||||
rules = {}
|
||||
lave_price = 0.0
|
||||
if type == 'all' or type == 'salary' or type == 'leave':
|
||||
for rule in rules_ids:
|
||||
rule_amount = termination_model.compute_rule(rule, emp.contract_id)
|
||||
|
|
@ -643,9 +657,9 @@ class ReportTerminationPublic(models.AbstractModel):
|
|||
data['total_sum']['ticket_num'] += ticket_num
|
||||
data['total_sum']['remaining_leaves'] += leave_balance
|
||||
data['total_sum']['lave_price'] += leave_balance_money
|
||||
data['total_sum']['termination_price'] += net
|
||||
data['total_sum']['five_year_price'] += cause_type_amount
|
||||
data['total_sum']['amount'] += cause_type_amount
|
||||
data['total_sum']['termination_price'] += cause_type_amount
|
||||
data['total_sum']['five_year_price'] += minus_five_years_amount
|
||||
data['total_sum']['amount'] += plus_five_years_amount
|
||||
data['total_sum']['total'] += total_allowance
|
||||
mykey = list(dict.fromkeys(key_list))
|
||||
return data, mykey
|
||||
|
|
|
|||
Loading…
Reference in New Issue