From dacd5f923be343fa952cbb0a6c46748b47be8d89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= <9664676+pengyuthon@user.noreply.gitee.com> Date: Tue, 3 Feb 2026 20:37:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- soong_workflow/data/soong_workflow_time.xml | 13 +++++ .../models/soong_workflow_record.py | 4 ++ yuthon_contract/models/inherit_hr_contract.py | 48 +++++++++---------- .../models/yuthon_vacation_reports.py | 24 +++++----- 4 files changed, 54 insertions(+), 35 deletions(-) diff --git a/soong_workflow/data/soong_workflow_time.xml b/soong_workflow/data/soong_workflow_time.xml index fdd74a5eb..cfe270d9a 100644 --- a/soong_workflow/data/soong_workflow_time.xml +++ b/soong_workflow/data/soong_workflow_time.xml @@ -1,6 +1,19 @@ + + 定时任务:催办提醒 + + code + model.task_reminders_record() + + + 1 + days + + -1 + + 定时任务:工作流的结束时间 diff --git a/soong_workflow/models/soong_workflow_record.py b/soong_workflow/models/soong_workflow_record.py index 179662de8..818071b04 100644 --- a/soong_workflow/models/soong_workflow_record.py +++ b/soong_workflow/models/soong_workflow_record.py @@ -586,6 +586,10 @@ class SoongWorkflowRecord(models.Model): res = super(SoongWorkflowRecord, self).unlink() return res + def task_reminders_record(self): + rec_ids = self.env["soong.workflow.record"].search([('approve_state', '=', 'pending')]) + for rec in rec_ids: + rec.reminders_record() # 催办 def reminders_record(self): diff --git a/yuthon_contract/models/inherit_hr_contract.py b/yuthon_contract/models/inherit_hr_contract.py index 0d979c484..ec8a75d5f 100644 --- a/yuthon_contract/models/inherit_hr_contract.py +++ b/yuthon_contract/models/inherit_hr_contract.py @@ -53,6 +53,7 @@ class HrContract(models.Model): ] ) is_probation = fields.Boolean(string="试用期") + is_copy = fields.Boolean(string='是否为复制合同', default=False) start_date = fields.Date( string="试用开始日期", required=True, default=fields.Date.today ) @@ -116,18 +117,36 @@ class HrContract(models.Model): 'default_employee_id': contract_ids.employee_id.id }} + @api.depends("contract_type_id", "employee_id", "is_copy") + def _compute_name(self): + for record in self: + if record.contract_type_id and record.employee_id: + base_name = record.employee_id.name + record.contract_type_id.name + "合同" + else: + base_name = "未完善合同信息" + + if record.is_copy: + record.name = f"{base_name}(副本)" + else: + record.name = base_name + + record.is_internship = record.contract_type_id.name == "实习协议" if record.contract_type_id else False + @api.returns('self', lambda value: value.id) def copy(self, default=None): self.ensure_one() default = dict(default or {}) - if 'name' not in default: - original_name = self.name or "" - clean_name = original_name.replace("(copy)", "").replace("(副本)", "").strip() - default['name'] = ("%s(副本)", clean_name) + default['is_copy'] = True default['date_start'] = fields.Date.today() default['date_end'] = False - return super(HrContract, self).copy(default=default) + version_str = self.version.lstrip('V') + main_version = version_str.split('.')[0] + new_main_version = int(main_version) + 1 + new_version = f"V{new_main_version}.0" + default['version'] = new_version + new_record = super(HrContract, self).copy(default=default) + return new_record @api.depends("date_start", "date_end") def _compute_current_contract(self): @@ -314,25 +333,6 @@ class HrContract(models.Model): else: record.is_internship = False - @api.depends("contract_type_id") - def _compute_name(self): - for record in self: - has_copy_suffix = "(副本)" in (record.name or "") - if record.contract_type_id and record.employee_id: - new_name = record.employee_id.name + record.contract_type_id.name + "合同" - else: - new_name = " " - - if has_copy_suffix: - record.name = new_name + "(副本)" - else: - record.name = new_name - - if record.contract_type_id: - record.is_internship = record.contract_type_id.name == "实习协议" - else: - record.is_internship = False - def action_hr_contract(self): return { "type": "ir.actions.act_window", diff --git a/yuthon_hr_attendance/models/yuthon_vacation_reports.py b/yuthon_hr_attendance/models/yuthon_vacation_reports.py index e93a9bbb3..883cf2571 100644 --- a/yuthon_hr_attendance/models/yuthon_vacation_reports.py +++ b/yuthon_hr_attendance/models/yuthon_vacation_reports.py @@ -59,22 +59,22 @@ class YuthonVacationReports(models.Model): leave = fields.Float(string='剩余年假', compute='_compute_leave', store=True, digits=(16, 3), group_operator=None) working_overtime = fields.Float(string='剩余补休', compute='_compute_working_overtime', store=True, digits=(16, 3), group_operator=None) - meal_fee = fields.Integer(string="误餐次数", compute='_compute_meal_fee', store=True, group_operator=None) + meal_fee = fields.Float(string="误餐次数", compute='_compute_meal_fee', store=True, group_operator=None) medical_fee = fields.Float(string="体检费", compute='_compute_medical_fee', store=True, group_operator=None) - compensatory_leave = fields.Integer(string="调休", compute='_compute_other_leave', store=True, group_operator=None) + compensatory_leave = fields.Float(string="调休", compute='_compute_other_leave', store=True, group_operator=None) leave_of_absence = fields.Float(string="事假", digits=(16, 3), compute='_compute_other_leave', store=True, group_operator=None) - statutory_leave = fields.Integer(string="加班时(法定)", compute='_compute_other_leave', store=True, group_operator=None, digits=(16, 3)) + statutory_leave = fields.Float(string="加班时(法定)", compute='_compute_other_leave', store=True, group_operator=None, digits=(16, 3)) cop_leave = fields.Float(string='补休', digits=(16, 3), store=True, compute='_compute_working_overtime', group_operator=None) - duty_off_leave = fields.Integer(string='值班调休', compute='_compute_other_leave', store=True, group_operator=None) - marriage_leave = fields.Integer(string='婚假', compute='_compute_other_leave', store=True, group_operator=None) - maternity_leave = fields.Integer(string='产假', compute='_compute_other_leave', store=True, group_operator=None) - paternity_leave = fields.Integer(string='陪产假', compute='_compute_other_leave', store=True, group_operator=None) - family_planning_leave = fields.Integer(string='计生假', compute='_compute_other_leave', store=True, group_operator=None) + duty_off_leave = fields.Float(string='值班调休', compute='_compute_other_leave', store=True, group_operator=None) + marriage_leave = fields.Float(string='婚假', compute='_compute_other_leave', store=True, group_operator=None) + maternity_leave = fields.Float(string='产假', compute='_compute_other_leave', store=True, group_operator=None) + paternity_leave = fields.Float(string='陪产假', compute='_compute_other_leave', store=True, group_operator=None) + family_planning_leave = fields.Float(string='计生假', compute='_compute_other_leave', store=True, group_operator=None) bereavement_leave = fields.Float(string='丧假', compute='_compute_other_leave', store=True, group_operator=None) - home_visit_leave = fields.Integer(string='探亲假', compute='_compute_other_leave', store=True, group_operator=None) - parents_meeting_leave = fields.Integer(string='家长会假', compute='_compute_other_leave', store=True, group_operator=None) + home_visit_leave = fields.Float(string='探亲假', compute='_compute_other_leave', store=True, group_operator=None) + parents_meeting_leave = fields.Float(string='家长会假', compute='_compute_other_leave', store=True, group_operator=None) general_sick_leave = fields.Float(string='病假(普通)', digits=(16, 3), compute='_compute_other_leave', store=True, group_operator=None) hospital_sick_leave = fields.Float(string='病假(住院期)', digits=(16, 3), compute='_compute_other_leave', store=True, group_operator=None) recovery_sick_leave = fields.Float(string='病假(出院恢复期)', digits=(16, 3), compute='_compute_other_leave', store=True, group_operator=None) @@ -549,7 +549,7 @@ class YuthonVacationReports(models.Model): self._context.get('active_ids', self._context.get('active_id', self.ids)) ) for record in records: - record._compute_working_overtime() + record.number_card = 4 @api.depends('vacation_date') def _compute_display_date(self): @@ -937,6 +937,8 @@ class YuthonVacationReports(models.Model): if rec.working_overtime: overtime_hours = rec.working_overtime * 8 self._update_over_lines(rec, [rec], overtime_hours) + if rec.employee_id.company_id.name == '集团本部': + rec.number_card = 4 if rec.remaining_parental_leave and last_month_record.parenting_line_ids: update_date = last_month_record.parenting_line_ids[0].update_date end_date = last_month_record.parenting_line_ids[0].end_date