diff --git a/hr_payroll_community/models/hr_payslip.py b/hr_payroll_community/models/hr_payslip.py index 4a83eb8..3a1f938 100644 --- a/hr_payroll_community/models/hr_payslip.py +++ b/hr_payroll_community/models/hr_payslip.py @@ -161,9 +161,15 @@ class HrPayslip(models.Model): # if we don't give the contract, then the rules to apply should be for all current contracts of the employee contract_ids = payslip.contract_id.ids or \ self.get_contract(payslip.employee_id, payslip.date_from, payslip.date_to) + for input_line in payslip.input_line_ids: + if input_line.code == 'LO': + loan_deduct = input_line.amount + else: + other_deduct += input_line.amount + print('tets+++++++++++++++++',loan_deduct,other_deduct) for contract in self.contract_id: - print('contract++++++++++++++++=',contract.wage,contract.hra,contract.other_allowance,contract.travel_allowance) total_salary = contract.wage + contract.other_allowance + contract.hra + contract.travel_allowance + net_salary = (total_salary -(loan_deduct + other_deduct) ) list_value =[(0, 0, { 'date_from':payslip.date_from, 'date_to':payslip.date_to, @@ -175,7 +181,10 @@ class HrPayslip(models.Model): 'other_allowance':contract.other_allowance, 'housing_allowance':contract.hra, 'travel_allowance':contract.travel_allowance, - 'total_salary':total_salary + 'total_salary':total_salary, + 'loan_deduct': loan_deduct, + 'monthly_deduct':other_deduct + 'net_salary':net_salary })] print('list_value============',list_value) payslip.emp_salary_line_ids = list_value