mirror of
https://gitlab.com/sonalarora/tra_backend.git
synced 2025-12-17 10:19:09 +02:00
work on payroll
This commit is contained in:
Binary file not shown.
@@ -63,7 +63,7 @@ class HrPayslip(models.Model):
|
|||||||
input_line_ids = fields.One2many('hr.payslip.input', 'payslip_id', string='Payslip Inputs',
|
input_line_ids = fields.One2many('hr.payslip.input', 'payslip_id', string='Payslip Inputs',
|
||||||
readonly=True, states={'draft': [('readonly', False)]})
|
readonly=True, states={'draft': [('readonly', False)]})
|
||||||
emp_salary_line_ids = fields.One2many('employee.salary.rule', 'emloyee_payslip_id', string='Salary rule',
|
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,
|
paid = fields.Boolean(string='Made Payment Order ? ', readonly=True, copy=False,
|
||||||
states={'draft': [('readonly', False)]})
|
states={'draft': [('readonly', False)]})
|
||||||
note = fields.Text(string='Internal Note', readonly=True, 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')
|
number = payslip.number or self.env['ir.sequence'].next_by_code('salary.slip')
|
||||||
# delete old payslip lines
|
# delete old payslip lines
|
||||||
payslip.line_ids.unlink()
|
payslip.line_ids.unlink()
|
||||||
|
payslip.emp_salary_line_ids.unlink()
|
||||||
# set the list of contract for which the rules have to be applied
|
# 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
|
# 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 \
|
contract_ids = payslip.contract_id.ids or \
|
||||||
self.get_contract(payslip.employee_id, payslip.date_from, payslip.date_to)
|
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)
|
print('contract++++++++++++++++=',contract)
|
||||||
self.emp_salary_line_ids[(0, 0, {
|
list_value =[(0, 0, {
|
||||||
'employee_id': self.employee_id.id})]
|
'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)]
|
lines = [(0, 0, line) for line in self._get_payslip_lines(contract_ids, payslip.id)]
|
||||||
payslip.write({'line_ids': lines, 'number': number})
|
payslip.write({'line_ids': lines, 'number': number})
|
||||||
return True
|
return True
|
||||||
@@ -659,14 +668,20 @@ class EmployeeSalary(models.Model):
|
|||||||
_name = 'employee.salary.rule'
|
_name = 'employee.salary.rule'
|
||||||
_description = 'Employee Payslip 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")
|
help="Employee")
|
||||||
emloyee_payslip_id = fields.Many2one('hr.payslip', string='Pay Slip',index=True, help="Payslip")
|
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()
|
other_allowance = fields.Float()
|
||||||
housing_allowance = fields.Float('Housing Allowance')
|
#housing_allowance = fields.Float('Housing Allowance')
|
||||||
travel_allowance = fields.Float('Transportation 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')
|
total_salary = fields.Float('Total Salary')
|
||||||
monthly_deduct = fields.Float('Monthly Deduction in AED')
|
monthly_deduct = fields.Float('Monthly Deduction in AED')
|
||||||
deduction_start_date = fields.Date('Deduction Start Date')
|
deduction_start_date = fields.Date('Deduction Start Date')
|
||||||
deduction_end_date = fields.Date('Deduction End 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,)
|
||||||
|
|||||||
@@ -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_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.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_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
|
||||||
|
|||||||
|
@@ -258,13 +258,15 @@
|
|||||||
<tree string="Employee Salary Rule" editable="bottom">
|
<tree string="Employee Salary Rule" editable="bottom">
|
||||||
<field name="employee_id"/>
|
<field name="employee_id"/>
|
||||||
<field name="basic_salary"/>
|
<field name="basic_salary"/>
|
||||||
<field name="other_allowance"/>
|
<field name="other_allowances"/>
|
||||||
<field name="housing_allowance"/>
|
<field name="housing_allowance"/>
|
||||||
<field name="travel_allowance"/>
|
<field name="travel_allowance"/>
|
||||||
<field name="total_salary"/>
|
<field name="total_salary"/>
|
||||||
<field name="monthly_deduct"/>
|
<field name="monthly_deduct"/>
|
||||||
<field name="deduction_start_date"/>
|
<field name="deduction_start_date"/>
|
||||||
<field name="deduction_end_date"/>
|
<field name="deduction_end_date"/>
|
||||||
|
<field name="currency_id"/>
|
||||||
|
<field name="company_id"/>
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
</page>
|
</page>
|
||||||
|
|||||||
Reference in New Issue
Block a user