diff --git a/hr_payroll_community/models/__pycache__/hr_payslip.cpython-36.pyc b/hr_payroll_community/models/__pycache__/hr_payslip.cpython-36.pyc index 558be6b..8de5fe9 100644 Binary files a/hr_payroll_community/models/__pycache__/hr_payslip.cpython-36.pyc and b/hr_payroll_community/models/__pycache__/hr_payslip.cpython-36.pyc differ diff --git a/hr_payroll_community/models/hr_payslip.py b/hr_payroll_community/models/hr_payslip.py index 3d21e7e..717d008 100644 --- a/hr_payroll_community/models/hr_payslip.py +++ b/hr_payroll_community/models/hr_payslip.py @@ -63,7 +63,7 @@ class HrPayslip(models.Model): input_line_ids = fields.One2many('hr.payslip.input', 'payslip_id', string='Payslip Inputs', readonly=True, states={'draft': [('readonly', False)]}) emp_salary_line_ids = fields.One2many('employee.salary.rule', 'emloyee_payslip_id', string='Salary rule', - readonly=True) + ) paid = fields.Boolean(string='Made Payment Order ? ', readonly=True, copy=False, states={'draft': [('readonly', False)]}) note = fields.Text(string='Internal Note', readonly=True, states={'draft': [('readonly', False)]}) @@ -156,14 +156,23 @@ class HrPayslip(models.Model): number = payslip.number or self.env['ir.sequence'].next_by_code('salary.slip') # delete old payslip lines payslip.line_ids.unlink() + payslip.emp_salary_line_ids.unlink() # set the list of contract for which the rules have to be applied # 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 contract in contract_ids: + for contract in self.contract_id: print('contract++++++++++++++++=',contract) - self.emp_salary_line_ids[(0, 0, { - 'employee_id': self.employee_id.id})] + list_value =[(0, 0, { + 'emloyee_payslip_id':self.id, + 'employee_id':payslip.employee_id.id, + 'basic_salary':contract.wage, + 'other_allowances':contract.other_allowance, + 'housing_allowance':contract.hra, + 'travel_allowance':contract.travel_allowance + })] + print('list_value============',list_value) + payslip.emp_salary_line_ids = list_value lines = [(0, 0, line) for line in self._get_payslip_lines(contract_ids, payslip.id)] payslip.write({'line_ids': lines, 'number': number}) return True @@ -659,14 +668,20 @@ class EmployeeSalary(models.Model): _name = 'employee.salary.rule' _description = 'Employee Payslip Salary Rule' - employee_id = fields.Many2one('hr.employee', string='Employee', required=True, readonly=True, + employee_id = fields.Many2one('hr.employee', string='Employee', help="Employee") emloyee_payslip_id = fields.Many2one('hr.payslip', string='Pay Slip',index=True, help="Payslip") - basic_salary = fields.Float() + #basic_salary = fields.Float() + basic_salary = fields.Integer('Basic Salary',help="Employee's monthly gross wage.") other_allowance = fields.Float() - housing_allowance = fields.Float('Housing Allowance') - travel_allowance = fields.Float('Transportation Allowance') + #housing_allowance = fields.Float('Housing Allowance') + #travel_allowance = fields.Float('Transportation Allowance') + other_allowances = fields.Monetary(string="Other Allowance", help="Other allowances") + housing_allowance = fields.Monetary(string='HRA', tracking=True, help="House rent allowance.") + travel_allowance = fields.Monetary(string="Travel Allowance", help="Travel allowance") total_salary = fields.Float('Total Salary') monthly_deduct = fields.Float('Monthly Deduction in AED') deduction_start_date = fields.Date('Deduction Start Date') deduction_end_date = fields.Date('Deduction End Date') + currency_id = fields.Many2one(string="Currency", related='company_id.currency_id', readonly=True) + company_id = fields.Many2one('res.company', default=lambda self: self.env.company,) diff --git a/hr_payroll_community/security/ir.model.access.csv b/hr_payroll_community/security/ir.model.access.csv index e94f4b7..ccbbb8c 100644 --- a/hr_payroll_community/security/ir.model.access.csv +++ b/hr_payroll_community/security/ir.model.access.csv @@ -12,4 +12,4 @@ access_hr_rule_input_officer,hr.rule.input.office,model_hr_rule_input,hr_payroll access_hr_salary_rule_user,hr.salary.rule.user,model_hr_salary_rule,hr_payroll_community.group_hr_payroll_community_user,1,1,1,1 access_hr_contract_advantage_template,hr.contract.advantage.template.user,model_hr_contract_advantage_template,hr_payroll_community.group_hr_payroll_community_user,1,1,1,1 access_hr_contract_advantage_template_hr_user,hr.contract.advantage.template.hr.user,model_hr_contract_advantage_template,hr.group_hr_user,1,0,0,0 -access_employee_salary_rule,employee.salary.rule.user,model_employee_salary_rule,hr.group_hr_user,1,1,0,0 +access_employee_salary_rule,employee.salary.rule.user,model_employee_salary_rule,hr.group_hr_user,1,1,1,1 diff --git a/hr_payroll_community/views/hr_payslip_views.xml b/hr_payroll_community/views/hr_payslip_views.xml index ef45abd..f1e1592 100644 --- a/hr_payroll_community/views/hr_payslip_views.xml +++ b/hr_payroll_community/views/hr_payslip_views.xml @@ -258,13 +258,15 @@ - + - + + + @@ -423,4 +425,4 @@ res_model="hr.payslip.line" id="act_contribution_reg_payslip_lines"/> - \ No newline at end of file +