termination transfer by emp type
This commit is contained in:
parent
ec6e4b3106
commit
9ad8519c69
|
|
@ -860,44 +860,42 @@ class HrTermination(models.Model):
|
|||
|
||||
def pay(self):
|
||||
line_vals = []
|
||||
emp_type = self.employee_id.employee_type_id.id
|
||||
for item in self.allowance_deduction_ids:
|
||||
# check if amount greater than 0.0 to fill move account lines
|
||||
if item.amount > 0.0:
|
||||
# check for deduction credit account
|
||||
if item.category_id.rule_type == 'deduction':
|
||||
if not item.account_credit_id:
|
||||
raise exceptions.Warning(
|
||||
_('Undefined credit account for salary rule %s.') % (item.salary_rule_id.name))
|
||||
# check for allowance debit account
|
||||
elif item.category_id.rule_type == 'allowance':
|
||||
if not item.account_debit_id:
|
||||
raise exceptions.Warning(
|
||||
_('Undefined debit account for salary rule %s.') % (item.salary_rule_id.name))
|
||||
else:
|
||||
if not item.account_debit_id:
|
||||
raise exceptions.Warning(_('Check account debit for salary rule "%s" ') % (
|
||||
item.salary_rule_id.name))
|
||||
|
||||
# fill move lines with allowance deduction
|
||||
amount = round(item.amount,2)
|
||||
if item.category_id.rule_type == 'allowance':
|
||||
account = item.salary_rule_id.get_debit_account_id(emp_type)
|
||||
if not account:
|
||||
raise exceptions.Warning(
|
||||
_('Sorry The Allowance %s is Not account Set') % item.salary_rule_id.name)
|
||||
line_vals.append({
|
||||
'name': ('Employee %s allowance.') % (self.employee_id.name),
|
||||
'debit': abs(amount),
|
||||
'account_id': item.account_debit_id.id,
|
||||
'account_id': account,
|
||||
'partner_id': self.employee_id.user_id.partner_id.id})
|
||||
|
||||
elif item.category_id.rule_type == 'deduction':
|
||||
account = item.salary_rule_id.get_credit_account_id(emp_type)
|
||||
if not account:
|
||||
raise exceptions.Warning(
|
||||
_('Sorry The Deduction %s is Not account Set') % item.salary_rule_id.name)
|
||||
line_vals.append({
|
||||
'name': ('Employee %s deduction.') % (self.employee_id.name),
|
||||
'credit': abs(amount),
|
||||
'account_id': item.account_credit_id.id,
|
||||
'account_id': account,
|
||||
'partner_id': self.employee_id.user_id.partner_id.id})
|
||||
else:
|
||||
account = item.salary_rule_id.get_debit_account_id(emp_type)
|
||||
if not account:
|
||||
raise exceptions.Warning(
|
||||
_('Sorry The Allowance %s is Not account Set') % item.salary_rule_id.name)
|
||||
line_vals.append({
|
||||
'name': ('Employee %s rule.') % (self.employee_id.name),
|
||||
'debit': abs(amount),
|
||||
'account_id': item.account_debit_id.id,
|
||||
'account_id': account,
|
||||
'partner_id': self.employee_id.user_id.partner_id.id})
|
||||
|
||||
for item in self.loans_ids:
|
||||
|
|
|
|||
Loading…
Reference in New Issue