diff --git a/yuthon_holiday/wizard/yuthon_leave_wizard.py b/yuthon_holiday/wizard/yuthon_leave_wizard.py index a909733f9..d577a67ab 100644 --- a/yuthon_holiday/wizard/yuthon_leave_wizard.py +++ b/yuthon_holiday/wizard/yuthon_leave_wizard.py @@ -33,8 +33,8 @@ class YuthonLeaveWizard(models.Model): holiday_status_id = self.env['hr.leave.type'].search([('name', '=', row[2].value)]) base_date = datetime(1900, 1, 1) if type(row[5].value) == float: - dt_from = base_date + timedelta(days=row[5].value - 1) if row[5].value > 0 else base_date - dt_to = base_date + timedelta(days=row[6].value - 1) if row[6].value > 0 else base_date + dt_from = base_date + timedelta(days=row[5].value - 2) if row[5].value > 0 else base_date + dt_to = base_date + timedelta(days=row[6].value - 2) if row[6].value > 0 else base_date else: dt_from = datetime.strptime(row[5].value, '%Y-%m-%d %H:%M') dt_to = datetime.strptime(row[6].value, '%Y-%m-%d %H:%M') @@ -65,8 +65,8 @@ class YuthonLeaveWizard(models.Model): leave = self.env['hr.leave'].sudo().create({ 'employee_id': employee_id.id, 'holiday_status_id': holiday_status_id.id, - 'request_date_from': dt_to, - 'request_date_to': dt_from, + 'request_date_from': dt_from, + 'request_date_to': dt_to, 'request_hour_from': request_hour_from[:2].lstrip('0'), 'request_hour_to': request_hour_to[:2].lstrip('0'), 'request_unit_hours':True,}) diff --git a/yuthon_hr_employee/models/yuthon_hr_employee.py b/yuthon_hr_employee/models/yuthon_hr_employee.py index e5d754909..0a3215461 100644 --- a/yuthon_hr_employee/models/yuthon_hr_employee.py +++ b/yuthon_hr_employee/models/yuthon_hr_employee.py @@ -43,7 +43,7 @@ class YuthonHrEmployee(models.Model): # 个人信息 user_salary = fields.Float(string="基本工资") job_lv_salary = fields.Float(string="职级工资") - salary_group_id = fields.Many2one('yuthon.salary.group', string="工资单分组") + salary_group_id = fields.Many2one('yuthon.salary.group', string="工资单分组", store=True, index=True) user_sex = fields.Selection([('girl', '女'), ('boy', '男')], string="性别") diff --git a/yuthon_salary/models/inherit_hr_payslip.py b/yuthon_salary/models/inherit_hr_payslip.py index d7eeef769..c0a95afd2 100644 --- a/yuthon_salary/models/inherit_hr_payslip.py +++ b/yuthon_salary/models/inherit_hr_payslip.py @@ -7,6 +7,7 @@ class InheritHrPayslip(models.Model): base_salary = fields.Float(string='基本工资', compute='_compute_salary', store=True) yuthon_company = fields.Selection([('thtz', '集团本部'), ('thwg', '天河物管'), ('thlc', '天河粮储')], related='employee_id.yuthon_company', string="所属公司") + salary_group_id = fields.Many2one(related='employee_id.salary_group_id', string="工资组", store=True, index=True) performance_bonuses = fields.Float(string='预发绩效奖金', compute='_compute_salary', store=True) full_attendance_award = fields.Float(string='全勤奖', compute='_compute_salary', store=True) commuting_allowance = fields.Float(string='通信补贴', compute='_compute_salary', store=True) @@ -45,6 +46,7 @@ class InheritHrPayslip(models.Model): attendance_deduction_total = fields.Float(string='考勤扣款合计') assessment_reserved_amount = fields.Float(string='考核保留量') is_push = fields.Boolean(string='推送') + is_salary_push = fields.Boolean(string='工资推送') @api.depends('line_ids') def _compute_salary(self): @@ -149,10 +151,50 @@ class InheritHrPayslip(models.Model): for record in self: record.write({'is_push': True}) - def return_button(self): for record in self: record.write({'is_push': False}) + def put_salary_button(self): + for record in self: + record.write({'is_salary_push': True}) + def return_salary_button(self): + for record in self: + record.write({'is_salary_push': False}) + def action_put_wizard(self): + return { + "type": "ir.actions.act_window", + "name": "推送个税计算", + "res_model": "put.wizard", + "view_mode": "form", + "target": "new", + } + + def action_return_wizard(self): + return { + "type": "ir.actions.act_window", + "name": "退回薪资计算", + "res_model": "return.wizard", + "view_mode": "form", + "target": "new", + } + + def action_put_salary_wizard(self): + return { + "type": "ir.actions.act_window", + "name": "推送工资确认", + "res_model": "put.salary.wizard", + "view_mode": "form", + "target": "new", + } + + def action_return_salary_wizard(self): + return { + "type": "ir.actions.act_window", + "name": "退回个税计算", + "res_model": "return.salary.wizard", + "view_mode": "form", + "target": "new", + } diff --git a/yuthon_salary/security/ir.model.access.csv b/yuthon_salary/security/ir.model.access.csv index e1c59dfab..13c401bab 100644 --- a/yuthon_salary/security/ir.model.access.csv +++ b/yuthon_salary/security/ir.model.access.csv @@ -10,4 +10,6 @@ access_yuthon_account_group,access_yuthon_account_group,model_yuthon_account_gro access_salary_payslip_wizard,access_salary_payslip_wizard,model_salary_payslip_wizard,base.group_user,1,1,1,1 access_select_delete_wizard,access_select_delete_wizard,model_select_delete_wizard,base.group_user,1,1,1,1 access_put_wizard,access_put_wizard,model_put_wizard,base.group_user,1,1,1,1 -access_return_wizard,access_return_wizard,model_return_wizard,base.group_user,1,1,1,1 \ No newline at end of file +access_return_wizard,access_return_wizard,model_return_wizard,base.group_user,1,1,1,1 +access_return_salary_wizard, access_return_salary_wizard,model_return_salary_wizard,base.group_user,1,1,1,1 +access_put_salary_wizard,access_put_salary_wizard,model_put_salary_wizard,base.group_user,1,1,1,1 \ No newline at end of file diff --git a/yuthon_salary/views/inherit_hr_payslip_views.xml b/yuthon_salary/views/inherit_hr_payslip_views.xml index 73aa7294c..7dbddb2f3 100644 --- a/yuthon_salary/views/inherit_hr_payslip_views.xml +++ b/yuthon_salary/views/inherit_hr_payslip_views.xml @@ -3,7 +3,7 @@ hr.payroll.inherit hr.payslip - + custom_salary_button @@ -39,15 +39,16 @@ - +