From 2b34ac4adc33ce8e91ae27f0c1f52c43333b7ec1 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: Mon, 22 Dec 2025 14:18:49 +0800 Subject: [PATCH 1/2] =?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 --- .../models/soong_workflow_record.py | 4 +- .../models/inherit_hr_leave_allocation.py | 2 +- .../wizard/leave_allocation_wizard.py | 53 ++++++++----- .../views/yuthon_vacation_reports_views.xml | 4 +- .../views/yuthon_service_approval_views.xml | 1 + .../models/processing_order_approval.py | 30 ++++---- .../models/property_report_repair.py | 5 +- .../views/processing_order_approval_views.xml | 2 +- .../views/property_report_repair.xml | 2 +- .../models/inherit_hr_payroll_structure.py | 10 ++- .../inherit_hr_payroll_structure_views.xml | 36 ++++++++- yuthon_salary/wizard/yuthon_payroll_wizard.py | 63 +++------------ yuthon_salary/wizard/yuthon_salary_wizard.py | 76 +++++++++++++------ yuthon_work_brand/views/hr_menus.xml | 6 ++ 14 files changed, 177 insertions(+), 117 deletions(-) diff --git a/soong_workflow/models/soong_workflow_record.py b/soong_workflow/models/soong_workflow_record.py index c99f6e6bb..3abce0cdc 100644 --- a/soong_workflow/models/soong_workflow_record.py +++ b/soong_workflow/models/soong_workflow_record.py @@ -352,8 +352,8 @@ class SoongWorkflowRecord(models.Model): for record in record_ids: record_id = record.env[record.res_model].search([('id', '=', record.res_id)]) record_list.append(record.id) - # if record_id.log_ids and self.env.user.name != "Administrator": - # raise UserError("当前流程不可删除") + if record_id.log_ids and self.env.user.name != "Administrator": + raise UserError("当前流程不可删除") wizard = self.env.ref("soong_workflow.view_soong_workflow_record_delete_wizard") return { "name": _("删除确认"), diff --git a/yuthon_holiday/models/inherit_hr_leave_allocation.py b/yuthon_holiday/models/inherit_hr_leave_allocation.py index 6717528d7..a6d96804f 100644 --- a/yuthon_holiday/models/inherit_hr_leave_allocation.py +++ b/yuthon_holiday/models/inherit_hr_leave_allocation.py @@ -179,7 +179,7 @@ class HrLeaveAllocation(models.Model): def update_vacation(self): leave_ids = self.env["hr.leave.allocation"].browse( self._context.get('active_ids', self._context.get('active_id'))) - date = datetime(2025, 10, 1) # 修改为你的日期 + date = datetime(2025, 12, 1) # 修改为你的日期 for leave in leave_ids: leave_list = [] compensatory_list = [] diff --git a/yuthon_holiday/wizard/leave_allocation_wizard.py b/yuthon_holiday/wizard/leave_allocation_wizard.py index c3c9e12ab..59b193e7d 100644 --- a/yuthon_holiday/wizard/leave_allocation_wizard.py +++ b/yuthon_holiday/wizard/leave_allocation_wizard.py @@ -36,27 +36,42 @@ class LeaveAllocationWizard(models.Model): holiday_status_id1 = self.env['hr.leave.type'].search([('name', '=', '补休')], limit=1) accrual_plan_id = self.env['hr.leave.accrual.plan'].search([('name', '=', '年假(天河物管)')], limit=1) if row[1].value and int(row[1].value) != 0: - number_of_days_display = int(row[1].value) / 8 - self.env['hr.leave.allocation'].create({ - 'employee_id': employee_id.id, - 'name': '年假公司分配', - 'number_of_days': number_of_days_display, - 'employee_ids': [(6, 0, [employee_id.id])], - 'holiday_status_id': holiday_status_id.id, - 'accrual_plan_id': accrual_plan_id.id, - 'allocation_type': 'accrual', - "number_of_days_display": number_of_days_display, - 'notes': '年假公司分配' - }) + number_of_days_display = int(row[1].value) + allocation_id = self.env['hr.leave.allocation'].search([('employee_id', '=', employee_id.id), + ('holiday_status_id', '=', holiday_status_id.id)]) + if allocation_id: + allocation_id.write({ + 'number_of_days': number_of_days_display + }) + else: + self.env['hr.leave.allocation'].create({ + 'employee_id': employee_id.id, + 'name': '年假公司分配', + 'number_of_days': number_of_days_display, + 'employee_ids': [(6, 0, [employee_id.id])], + 'holiday_status_id': holiday_status_id.id, + 'accrual_plan_id': accrual_plan_id.id, + 'allocation_type': 'accrual', + 'date_from': datetime(2025, 1, 1), + 'notes': '年假公司分配' + }) if row[2].value and int(row[2].value) != 0: - self.env['hr.leave.allocation'].create({ - 'holiday_status_id': holiday_status_id1.id, - 'employee_id': employee_id.id, - 'name': '补休', - 'employee_ids': [(6, 0, [employee_id.id])], - 'number_of_hours_display': int(row[2].value) - }) + allocation_id = self.env['hr.leave.allocation'].search([('employee_id', '=', employee_id.id), + ('holiday_status_id', '=', holiday_status_id1.id)]) + if allocation_id: + allocation_id.write({ + 'number_of_hours': int(row[2].value), + }) + else: + self.env['hr.leave.allocation'].create({ + 'holiday_status_id': holiday_status_id1.id, + 'employee_id': employee_id.id, + 'name': '补休', + 'date_from': datetime(2025, 12, 1), + 'employee_ids': [(6, 0, [employee_id.id])], + 'number_of_hours_display': int(row[2].value) + }) diff --git a/yuthon_hr_attendance/views/yuthon_vacation_reports_views.xml b/yuthon_hr_attendance/views/yuthon_vacation_reports_views.xml index 12e670032..5098603cf 100644 --- a/yuthon_hr_attendance/views/yuthon_vacation_reports_views.xml +++ b/yuthon_hr_attendance/views/yuthon_vacation_reports_views.xml @@ -4,7 +4,7 @@ yuthon.vacation.reports.tree yuthon.vacation.reports - + @@ -452,7 +452,7 @@ 考勤确认单台账 yuthon.vacation.reports tree,form - {'search_default_group_by_employee_id': 1, 'search_default_group_by_vacation_year': True, 'search_default_group_by_vacation_month': True} + {'search_default_group_by_employee_id': 1, 'search_default_group_by_vacation_month': True} diff --git a/yuthon_hr_employee_approval/views/yuthon_service_approval_views.xml b/yuthon_hr_employee_approval/views/yuthon_service_approval_views.xml index ddc73c278..10aa4fb62 100644 --- a/yuthon_hr_employee_approval/views/yuthon_service_approval_views.xml +++ b/yuthon_hr_employee_approval/views/yuthon_service_approval_views.xml @@ -50,6 +50,7 @@ + diff --git a/yuthon_maintain/models/processing_order_approval.py b/yuthon_maintain/models/processing_order_approval.py index b6a6f7bbd..1a425d4f1 100644 --- a/yuthon_maintain/models/processing_order_approval.py +++ b/yuthon_maintain/models/processing_order_approval.py @@ -91,13 +91,16 @@ class ProcessingOrderApproval(models.Model): ], limit=1 ) + else: + record.contract_id = False + if contract_id and contract_id.lease_id: record.contract_id = contract_id.lease_id.id else: - record.contract_id = None + record.contract_id = False @api.onchange('repair_id') - def _onchange_repair_id(self): + def onchange_repair_id(self): if self.repair_id: self.property_id = self.repair_id.property_id self.lessee_id = self.repair_id.lessee_id @@ -143,16 +146,17 @@ class ProcessingOrderApproval(models.Model): def end_approval(self): for rec in self: - menu_id = self.env['ir.ui.menu'].search([('name', '=', '处理单')]) - url = f'https://oa.thtzjt.com/web#id={self.id}&cids=2&action={menu_id.action.id}&model=processing.order.approval&view_type=list&menu_id={menu_id.id}' - self.sudo().env["wecom.apps"].sync_send_message_textcard(category='oa', - user_id=rec.applicant_id.employee_id.wecom_userid, - title="处理单", - description="你有一份已处理的报时报修", - url=url, btntxt="详细信息") - if rec.device_id: - rec.device_id.report_state = 'done' - else: - rec.repair_id.report_state = 'done' + if rec.processing_results in ['done', 'part']: + menu_id = self.env['ir.ui.menu'].search([('name', '=', '处理单审批')]) + url = f'https://oa.thtzjt.com/web#id={self.id}&cids=2&action={menu_id.action.id}&model=processing.order.approval&view_type=list&menu_id={menu_id.id}' + if rec.device_id: + rec.device_id.report_state = 'done' + else: + rec.repair_id.report_state = 'done' + self.sudo().env["wecom.apps"].sync_send_message_textcard(category='oa', + user_id=rec.applicant_id.employee_id.wecom_userid, + title="处理单", + description="你有一份已处理的报时报修", + url=url, btntxt="详细信息") diff --git a/yuthon_maintain/models/property_report_repair.py b/yuthon_maintain/models/property_report_repair.py index f229bc25c..8cec20bbe 100644 --- a/yuthon_maintain/models/property_report_repair.py +++ b/yuthon_maintain/models/property_report_repair.py @@ -20,7 +20,6 @@ class PropertyRentRelief(models.Model): lessee_id = fields.Many2one('property.tenant.information', string="承租方") contact = fields.Char(string="联系人") phone = fields.Char( string="联系电话") - leader_id = fields.Many2one('res.users', string="负责人") types_repairs = fields.Selection([('hydropower', '水电维修'), ('building', '门窗维修'), ('other', '其他维修')], string='维修类型') problem_description = fields.Text(string="问题描述") remake = fields.Text(string="备注") @@ -33,7 +32,7 @@ class PropertyRentRelief(models.Model): self_users_ids = fields.Many2many('res.users', string="当前经办人", default=lambda self: [(6, 0, [self.env.user.id])]) create_time = fields.Date(string="填报日期", default=fields.Datetime.now) - processing_order_id = fields.Many2one('processing.order.approval', string="处理单流程") + processing_order_id = fields.Many2one('processing.order.approval', string="处理单") def _get_default_name_title(self): return self._description if self._description else self._name @@ -73,8 +72,10 @@ class PropertyRentRelief(models.Model): 'repair_id': self.id, 'applicant_id': self.users_id.id, 'name': self.problem_description, + 'problem_description': self.problem_description, 'code': self.env['ir.sequence'].next_by_code('property_report_repair_code'), }) + order_id.onchange_repair_id() workflow_record_id = self.env['soong.workflow.record'].search([ ('code', '=', self.code), ]) diff --git a/yuthon_maintain/views/processing_order_approval_views.xml b/yuthon_maintain/views/processing_order_approval_views.xml index ac5c066f9..a2a1c4e9a 100644 --- a/yuthon_maintain/views/processing_order_approval_views.xml +++ b/yuthon_maintain/views/processing_order_approval_views.xml @@ -9,8 +9,8 @@