fix
This commit is contained in:
parent
55f2f4ad8c
commit
45d9266364
|
|
@ -221,7 +221,7 @@ class HrTermination(models.Model):
|
|||
days = item.employee_id.resource_calendar_id.work_days
|
||||
day_amount = item.salary / days
|
||||
holiday_amount = item.leave_balance * day_amount
|
||||
item.leave_balance_money = holiday_amount
|
||||
item.leave_balance_money = round(holiday_amount,2)
|
||||
|
||||
@api.onchange('salary_termination')
|
||||
def _check_last_salary(self):
|
||||
|
|
@ -269,7 +269,7 @@ class HrTermination(models.Model):
|
|||
# If cause type have factor then multiply it in salary rule amount
|
||||
if self.cause_type and cause_type_factor == 1:
|
||||
if self.cause_type.allowance_id and self.cause_type_amount:
|
||||
amount = self.cause_type_amount
|
||||
amount = round(self.cause_type_amount,2)
|
||||
# If cause type have holiday then multiply it in salary rule holiday amount
|
||||
holiday_allow = self.cause_type.holiday_allowance
|
||||
holiday_deduc = self.cause_type.holiday_deduction
|
||||
|
|
@ -320,13 +320,12 @@ class HrTermination(models.Model):
|
|||
raise exceptions.Warning(_('Employee "%s" has no contract') % self.employee_id.name)
|
||||
except:
|
||||
raise UserError(_('Wrong quantity defined for salary Rule " %s " ') % (rule.name))
|
||||
return amount
|
||||
return round(amount,2)
|
||||
|
||||
# Compute salary rules
|
||||
|
||||
def compute_rule(self, rule, contract):
|
||||
localdict = dict(employee=contract.employee_id, contract=contract)
|
||||
|
||||
if rule.amount_select == 'percentage':
|
||||
total_percent = 0
|
||||
if rule.related_benefits_discounts:
|
||||
|
|
@ -537,7 +536,7 @@ class HrTermination(models.Model):
|
|||
resedual = 0
|
||||
|
||||
reward_amount = reward_amount * line_amount
|
||||
self.cause_type_amount = reward_amount
|
||||
self.cause_type_amount = round(reward_amount,2)
|
||||
amount = self.compute_salary_rule(self.cause_type.allowance_id, items,
|
||||
duration_percentage, False, 1)
|
||||
if self.cause_type.holiday:
|
||||
|
|
@ -692,7 +691,7 @@ class HrTermination(models.Model):
|
|||
for line in item.loans_ids:
|
||||
total += line.remaining_loan_amount
|
||||
item.loans_total = total
|
||||
item.total_loans = total
|
||||
item.total_loans = round(total,2)
|
||||
|
||||
# compute total allowance and deduction amount
|
||||
@api.onchange('allowance_deduction_ids')
|
||||
|
|
@ -712,8 +711,8 @@ class HrTermination(models.Model):
|
|||
|
||||
self.deduction_total = total_deduction
|
||||
self.allowance_total = total_allowance
|
||||
self.net = abs(self.allowance_total) - abs(self.deduction_total)
|
||||
self.net -= abs(self.total_loans)
|
||||
self.net = abs(round(self.allowance_total,2)) - abs(round(self.deduction_total,2))
|
||||
self.net -= abs(round(self.total_loans,2))
|
||||
|
||||
# Compute net
|
||||
# @api.depends('allowance_total')
|
||||
|
|
@ -879,36 +878,37 @@ class HrTermination(models.Model):
|
|||
item.salary_rule_id.name))
|
||||
|
||||
# fill move lines with allowance deduction
|
||||
amount = round(item.amount,2)
|
||||
if item.category_id.rule_type == 'allowance':
|
||||
line_vals.append({
|
||||
'name': ('Employee %s allowance.') % (self.employee_id.name),
|
||||
'debit': abs(item.amount),
|
||||
'debit': abs(amount),
|
||||
'account_id': item.account_debit_id.id,
|
||||
'partner_id': self.employee_id.user_id.partner_id.id})
|
||||
|
||||
elif item.category_id.rule_type == 'deduction':
|
||||
line_vals.append({
|
||||
'name': ('Employee %s deduction.') % (self.employee_id.name),
|
||||
'credit': abs(item.amount),
|
||||
'credit': abs(amount),
|
||||
'account_id': item.account_credit_id.id,
|
||||
'partner_id': self.employee_id.user_id.partner_id.id})
|
||||
else:
|
||||
line_vals.append({
|
||||
'name': ('Employee %s rule.') % (self.employee_id.name),
|
||||
'debit': abs(item.amount),
|
||||
'debit': abs(amount),
|
||||
'account_id': item.account_debit_id.id,
|
||||
'partner_id': self.employee_id.user_id.partner_id.id})
|
||||
|
||||
for item in self.loans_ids:
|
||||
line_vals.append({
|
||||
'name': ('Employee %s loans.') % (self.employee_id.name),
|
||||
'credit': abs(item.remaining_loan_amount),
|
||||
'credit': abs(round(item.remaining_loan_amount,2)),
|
||||
'account_id': item.request_type.account_id.id,
|
||||
'partner_id': self.employee_id.user_id.partner_id.id})
|
||||
|
||||
line_vals.append({
|
||||
'name': ('Employee %s Net.') % (self.employee_id.name),
|
||||
'credit': abs(self.net),
|
||||
'credit': abs(round(self.net,2)),
|
||||
'account_id': self.journal.default_account_id.id,
|
||||
'partner_id': self.employee_id.user_id.partner_id.id})
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue