From 25a834f0eee7eb0cb8b015912a559e54057dbc2d 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: Wed, 31 Dec 2025 16:23:30 +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 --- .../models/soong_workflow_record.py | 22 +++++++++---------- .../wizard/soong_workflow_comment_wizard.py | 7 ------ .../models/yuthon_vacation_reports.py | 16 ++++++++++++++ .../views/yuthon_vacation_reports_views.xml | 15 +++++++++++++ .../wizard/property_statements_wizard.py | 21 ++++++++++++++++++ 5 files changed, 62 insertions(+), 19 deletions(-) diff --git a/soong_workflow/models/soong_workflow_record.py b/soong_workflow/models/soong_workflow_record.py index 37e7870d7..c3b88c902 100644 --- a/soong_workflow/models/soong_workflow_record.py +++ b/soong_workflow/models/soong_workflow_record.py @@ -240,20 +240,18 @@ class SoongWorkflowRecord(models.Model): @api.model def get_view(self, view_id=None, view_type='form', **options): - """在视图加载时检查当前用户是否在经办人列表中,并更新状态""" current_employee = self.env['hr.employee'].search([('user_id', '=', self.env.uid)], limit=1) if current_employee: - all_records = self.search([]) - # 更新当前用户经办的记录为"待办" - user_records = all_records.search([ - ('employee_ids', 'in', current_employee.id), - ]) - user_records.write({'soong_state': 'to_do'}) - - # 更新其他记录为"已办" - other_records = all_records - user_records - other_records.write({'soong_state': 'done'}) - + all_records = self.search([('employee_ids', 'in', current_employee.id)]) + for record in all_records: + record_id = self.env[record.res_model].browse(record.res_id) + if record_id: + for log in record_id.log_ids: + if log.done_by == self.env.user: + if log.approval_state == 0: + record.write({'soong_state': 'to_do'}) + else: + record.write({'soong_state': 'done'}) return super(SoongWorkflowRecord, self).get_view(view_id, view_type, **options) # def get_department_employees(self, department_id): diff --git a/soong_workflow/wizard/soong_workflow_comment_wizard.py b/soong_workflow/wizard/soong_workflow_comment_wizard.py index 9e1790f6f..c4745e884 100644 --- a/soong_workflow/wizard/soong_workflow_comment_wizard.py +++ b/soong_workflow/wizard/soong_workflow_comment_wizard.py @@ -620,13 +620,6 @@ class SoongWorkflowCommentWizard(models.TransientModel): elif hasattr(biz_record, 'users_id') and biz_record.users_id: employee = biz_record.users_id.employee_ids action_id = self.env['ir.actions.act_window'].search([('res_model', '=', self.res_model)])[0] - # url = f'https://oa.thtzjt.com/web?login={employee.user_id.login}&oauth_uid={employee.wecom_userid}#id={record_id.id}&cids=2&action={action_id.id}&model={record_id._name}&view_type=form&menu_id=10104' - # self.sudo().env["wecom.apps"].sync_send_message_textcard(category='oa', - # user_id=employee.wecom_userid, - # title=record_id._description, - # description=f"编号为{record_id.code}的{record_id._description}已结束", - # url=url, btntxt="查看详情") - recipients = [] if self.node_btn_id.workflow_id.archive_type == 'applicant': biz_record = self.env[self.res_model].browse(self.res_id) diff --git a/yuthon_hr_attendance/models/yuthon_vacation_reports.py b/yuthon_hr_attendance/models/yuthon_vacation_reports.py index b187fed72..09df97c55 100644 --- a/yuthon_hr_attendance/models/yuthon_vacation_reports.py +++ b/yuthon_hr_attendance/models/yuthon_vacation_reports.py @@ -18,6 +18,22 @@ class YuthonVacationReports(models.Model): employee_id = fields.Many2one('hr.employee', string='员工') salary_group_id = fields.Many2one(related='employee_id.salary_group_id', string="工资单分组", store=True) department_id = fields.Many2one(related='employee_id.department_id', string="部门", store=True) + open_start_time = fields.Date(related='employee_id.open_start_time',string="参加工作时间") + years_of_service = fields.Integer(related='employee_id.job_id.years_of_service', string="工作年限") + previous_year = fields.Float(string="上年剩余") + valid_date = fields.Date(string="有效期至") + year_distribution = fields.Float(string="本年发放") + used_this_year = fields.Float(string="本年已用") + remainder_year = fields.Float(string="本年剩余(年假)") + last_holiday = fields.Float(string="上年公休日") + last_workday = fields.Float(string="上年工作日") + valid_date1 = fields.Date(string="有效期至") + year_holiday = fields.Float(string="本年公休日") + year_workday = fields.Float(string="本年工作日") + year_sum = fields.Float(string="本年应休合计") + used_this_year1 = fields.Float(string="本年已休") + remainder_year1 = fields.Float(string="本年剩余(补休)") + company_id = fields.Many2one(related="employee_id.company_id", string="公司", store=True) late_allowed = fields.Float(related="employee_id.late_allowed", string="允许迟到次数") leave_ids = fields.One2many('vacation.leave.line', 'vacation_id', string='年假明细') diff --git a/yuthon_hr_attendance/views/yuthon_vacation_reports_views.xml b/yuthon_hr_attendance/views/yuthon_vacation_reports_views.xml index b4c78197c..23bfe2ca2 100644 --- a/yuthon_hr_attendance/views/yuthon_vacation_reports_views.xml +++ b/yuthon_hr_attendance/views/yuthon_vacation_reports_views.xml @@ -11,6 +11,21 @@ + + + + + + + + + + + + + + + diff --git a/yuthon_property/wizard/property_statements_wizard.py b/yuthon_property/wizard/property_statements_wizard.py index 747f31112..7c369f47b 100644 --- a/yuthon_property/wizard/property_statements_wizard.py +++ b/yuthon_property/wizard/property_statements_wizard.py @@ -45,11 +45,18 @@ class PropertyStatementsWizard(models.Model): cleaned_amount = original_amount.replace(',', '') float_amount = float(cleaned_amount) your_own_unit = self.classify_by_last_four(your_own_account) + if your_own_unit in ['天河投资', '天投城建']: + company_id = self.env['res.company'].search([('name', '=', '集团本部')], limit=1) + elif your_own_unit in ['天河物管']: + company_id = self.env['res.company'].search([('name', '=', '天河物管')], limit=1) + elif your_own_unit in ['天河粮储']: + company_id = self.env['res.company'].search([('name', '=', '天河粮储')], limit=1) sequence_number = row[5].value bank_data = { 'name': name, 'your_own_unit': your_own_unit, 'original_amount': float_amount, + 'company_id': company_id.id, 'sequence_number': sequence_number, 'start_time': start_time - timedelta(hours=8), 'your_own_account': your_own_account, @@ -81,11 +88,18 @@ class PropertyStatementsWizard(models.Model): extract = row[11].value serial_number = row[13].value your_own_unit = self.classify_by_last_four(your_own_account) + if your_own_unit in ['天河投资', '天投城建']: + company_id = self.env['res.company'].search([('name', '=', '集团本部')], limit=1) + elif your_own_unit in ['天河物管']: + company_id = self.env['res.company'].search([('name', '=', '天河物管')], limit=1) + elif your_own_unit in ['天河粮储']: + company_id = self.env['res.company'].search([('name', '=', '天河粮储')], limit=1) bank_data = { 'name': name, 'serial_number': serial_number, 'your_own_unit': your_own_unit, 'no_amount': original_amount, + 'company_id': company_id.id, 'bank_branch': bank_branch, 'original_amount': original_amount, 'start_time': start_time - timedelta(hours=8), @@ -124,10 +138,17 @@ class PropertyStatementsWizard(models.Model): serial_number = row[0].value lending_direction = lending_direction your_own_unit = self.classify_by_last_four(your_own_account) + if your_own_unit in ['天河投资', '天投城建']: + company_id = self.env['res.company'].search([('name', '=', '集团本部')], limit=1) + elif your_own_unit in ['天河物管']: + company_id = self.env['res.company'].search([('name', '=', '天河物管')], limit=1) + elif your_own_unit in ['天河粮储']: + company_id = self.env['res.company'].search([('name', '=', '天河粮储')], limit=1) bank_data = { 'name': name, 'serial_number': serial_number, 'your_own_unit': your_own_unit, + 'company_id': company_id.id, 'bank_branch': bank_branch, 'no_amount': original_amount, 'original_amount': original_amount,