diff --git a/yuthon_contract/models/inherit_hr_contract.py b/yuthon_contract/models/inherit_hr_contract.py index 2d5f688e2..f2be7a908 100644 --- a/yuthon_contract/models/inherit_hr_contract.py +++ b/yuthon_contract/models/inherit_hr_contract.py @@ -170,8 +170,9 @@ class HrContract(models.Model): "view_mode": "form", "context": { "default_employee_id": self.employee_id.id, - "default_current_status": self.date_end, + "default_current_status": self.employee_id.contract_id.date_end, "default_department1_id": self.employee_id.department_id.id, + "default_renewal_date": self.employee_id.contract_id.date_end + relativedelta(years=3), "default_contract_id": self.id, }, } diff --git a/yuthon_hr_attendance/__manifest__.py b/yuthon_hr_attendance/__manifest__.py index 2701e7f91..a14650f01 100644 --- a/yuthon_hr_attendance/__manifest__.py +++ b/yuthon_hr_attendance/__manifest__.py @@ -64,6 +64,7 @@ 'views/hr_attendance_portal_templates.xml', 'views/meal_approval.xml', 'views/applet_address_views.xml', + 'views/yuthon.overtime.report.xml', 'views/all_attendance_menu.xml', 'views/overtime_approval_inherit_header.xml', diff --git a/yuthon_hr_attendance/models/__init__.py b/yuthon_hr_attendance/models/__init__.py index 70115ca77..84767ebfd 100644 --- a/yuthon_hr_attendance/models/__init__.py +++ b/yuthon_hr_attendance/models/__init__.py @@ -32,6 +32,7 @@ from . import meal_approval from . import back_approval from . import staff_dining_report from . import message_reminder_tasks +from . import yuthon_overtime_report # from odoo.tools import SQL # import odoo diff --git a/yuthon_hr_attendance/models/yuthon_overtime_report.py b/yuthon_hr_attendance/models/yuthon_overtime_report.py new file mode 100644 index 000000000..8137c7968 --- /dev/null +++ b/yuthon_hr_attendance/models/yuthon_overtime_report.py @@ -0,0 +1,34 @@ +from odoo import api, fields, models, tools, _ +from datetime import datetime, time, timedelta +from odoo.exceptions import UserError +from datetime import date, timedelta + + +class YuthonOvertimeReport(models.Model): + _name = 'yuthon.overtime.report' + _description = '加班费记录' + + employee_id = fields.Many2one('hr.employee', string="员工") + department_id = fields.Many2one('hr.department',string="部门") + overtime_date = fields.Char(string="加班时间") + carry_forward_date = fields.Date(string="结转日期") + carry_forward_duration = fields.Float(string="结转时长") + carry_forward_result = fields.Selection( + selection=[ + ('success', '成功'), + ('failed', '失败') + ], + string='结转结果', + ) + validity = fields.Char(string="有效期") + carry_forward_state = fields.Selection( + selection=[ + ('pending', '待结转'), + ('completed', '已结转'), + ('partial', '部分结转') + ], + string='结转状态', + default='pending', + ) + remaining_quantity = fields.Float(string='剩余数') + diff --git a/yuthon_hr_attendance/security/ir.model.access.csv b/yuthon_hr_attendance/security/ir.model.access.csv index 8f6eb2365..ab8aa2057 100644 --- a/yuthon_hr_attendance/security/ir.model.access.csv +++ b/yuthon_hr_attendance/security/ir.model.access.csv @@ -82,4 +82,5 @@ access_vacation_put_wizard,vacation.put.wizard,model_vacation_put_wizard,base.gr access_message_reminder_tasks,message.reminder.tasks,model_message_reminder_tasks,base.group_user,1,1,1,1 access_applet_security_quick_perm_wizard,access_applet_security_quick_perm_wizard,model_applet_security_quick_perm_wizard,base.group_user,1,1,1,1 -access_vacation_reports_wizard,vacation.reports.wizard,model_vacation_reports_wizard,base.group_user,1,1,1,1 \ No newline at end of file +access_vacation_reports_wizard,vacation.reports.wizard,model_vacation_reports_wizard,base.group_user,1,1,1,1 +access_yuthon_overtime_report,access_yuthon_overtime_report,model_yuthon_overtime_report,base.group_user,1,1,1,1 \ No newline at end of file diff --git a/yuthon_hr_attendance/views/all_attendance_menu.xml b/yuthon_hr_attendance/views/all_attendance_menu.xml index 620d0b59c..8b9a3c509 100644 --- a/yuthon_hr_attendance/views/all_attendance_menu.xml +++ b/yuthon_hr_attendance/views/all_attendance_menu.xml @@ -222,4 +222,16 @@ parent="menu_hr_attendance_approval_request" sequence="15" action="view_back_approval_action"/> + + + + + diff --git a/yuthon_hr_attendance/views/yuthon.overtime.report.xml b/yuthon_hr_attendance/views/yuthon.overtime.report.xml new file mode 100644 index 000000000..c56c91e82 --- /dev/null +++ b/yuthon_hr_attendance/views/yuthon.overtime.report.xml @@ -0,0 +1,31 @@ + + + + yuthon.overtime.report.tree + yuthon.overtime.report + + + + + + + + + + + + + + + + + 加班费记录 + yuthon.overtime.report + tree + +

+ 暂无加班费记录 +

+
+
+
\ No newline at end of file diff --git a/yuthon_hr_employee_approval/models/yuthon_renewal_approval.py b/yuthon_hr_employee_approval/models/yuthon_renewal_approval.py index 0b5f31273..a2a11bc88 100644 --- a/yuthon_hr_employee_approval/models/yuthon_renewal_approval.py +++ b/yuthon_hr_employee_approval/models/yuthon_renewal_approval.py @@ -1,6 +1,8 @@ from odoo import models, fields, api from odoo.exceptions import UserError +from dateutil.relativedelta import relativedelta + class YuthonRenewalApproval(models.Model): _name = 'yuthon.renewal.approval' @@ -26,7 +28,7 @@ class YuthonRenewalApproval(models.Model): user_sex = fields.Selection(related='employee_id.user_sex', string="性别") degree = fields.Char(related='employee_id.high_degree', string="学历") onboard_time = fields.Date(related='employee_id.contract_id.date_of_entry', string='入职时间') - current_status = fields.Date(related='employee_id.contract_id.date_end',string='合同到期日') + current_status = fields.Date(string='合同到期日') renewal_date = fields.Date(string="续签日期") contract = fields.Char(string="劳动合同签订情况") condition_review = fields.Text(string="续期条件审核") @@ -39,3 +41,22 @@ class YuthonRenewalApproval(models.Model): name_title = fields.Char(default=_get_default_name_title) self_users_ids = fields.Many2many('res.users', string="当前经办人", default=lambda self: [(6, 0, [self.env.user.id])]) + def end_approval(self): + self.ensure_one() + original_contract = self.employee_id.contract_id + version_num = float(self.employee_id.contract_id.version.lstrip('Vv')) + new_version_num = version_num + 1.0 + new_version = f"V{new_version_num:.1f}" + new_contract_vals = original_contract.copy_data()[0] + new_contract_vals.update({ + 'date_end': self.renewal_date, + 'date_start': original_contract.date_end + relativedelta(days=1), + 'state': 'open', + 'job_id': self.job_id.id, + 'version': new_version, + 'structure_type_id': self.payroll_structure_id.type_id.id, + 'department_id': self.department1_id.id + }) + new_contract = self.env['hr.contract'].create(new_contract_vals) + self.employee_id.write({'contract_id': new_contract.id}) + diff --git a/yuthon_hr_employee_approval/views/yuthon_renewal_approval_views.xml b/yuthon_hr_employee_approval/views/yuthon_renewal_approval_views.xml index 5b43511d6..177d57f5a 100644 --- a/yuthon_hr_employee_approval/views/yuthon_renewal_approval_views.xml +++ b/yuthon_hr_employee_approval/views/yuthon_renewal_approval_views.xml @@ -43,6 +43,9 @@ +
+
@@ -61,6 +64,7 @@ +