From 3feaf50f0eeacfd6d39f49f5e6bed01d9fcbab65 Mon Sep 17 00:00:00 2001
From: zhou <123@>
Date: Wed, 11 Jun 2025 10:33:48 +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 | 18 ++++++++
.../views/soong_workflow_record.xml | 4 +-
.../views/yuthon_vacation_reports_views.xml | 2 +-
.../models/yuthon_hr_employee.py | 41 +++++--------------
.../views/yuthon_hr_employee_views.xml | 12 ++----
yuthon_property/views/menuitem.xml | 4 +-
.../models/inherit_yuthon_property.py | 29 ++++---------
.../wizard/property_reconciliation_wizard.py | 2 +-
.../property_reconciliation_wizard_views.xml | 4 +-
9 files changed, 50 insertions(+), 66 deletions(-)
diff --git a/soong_workflow/models/soong_workflow_record.py b/soong_workflow/models/soong_workflow_record.py
index d05a88dc0..dda3c6b2f 100644
--- a/soong_workflow/models/soong_workflow_record.py
+++ b/soong_workflow/models/soong_workflow_record.py
@@ -47,6 +47,7 @@ class SoongWorkflowRecord(models.Model):
department_id = fields.Many2one("hr.department", string="部门", required=True)
done_by = fields.Many2one(comodel_name="res.users", string="发起人")
active = fields.Boolean(string="归档", default=True)
+ soong_state = fields.Selection([('to_do', '待办'), ('done', '已办')], string="流程状态", default="done")
member_of_department = fields.Boolean("是否是本部门数据", compute='_compute_part_of_department', search='_search_part_of_department')
@api.depends_context('uid', 'company')
@@ -100,6 +101,23 @@ class SoongWorkflowRecord(models.Model):
"view_mode": "form",
}
+ @api.model
+ def get_view(self, view_id=None, view_type='form', **options):
+ """在视图加载时检查当前用户是否在经办人列表中,并更新状态"""
+ # 检查是否通过特定动作触发(替换为你的视图ID)
+ if options.get('action_id') == 538: # 替换为实际的视图ID
+ current_employee = self.env['hr.employee'].search([('user_id', '=', self.env.uid)], limit=1)
+ if current_employee:
+ # 更新所有当前用户是经办人的记录状态为"待办"
+ records = self.search([
+ ('employee_ids', 'in', current_employee.ids),
+ ('soong_state', '=', 'done')
+ ])
+ if records:
+ records.write({'soong_state': 'to_do'})
+
+ return super(SoongWorkflowRecord, self).get_view(view_id, view_type, **options)
+
# def get_department_employees(self, department_id):
# valid_user_ids = set()
# employee_ids = self.sudo().env['hr.employee'].search([('department_id', '=', department_id.id)])
diff --git a/soong_workflow/views/soong_workflow_record.xml b/soong_workflow/views/soong_workflow_record.xml
index 0fab0d917..1f5301a06 100644
--- a/soong_workflow/views/soong_workflow_record.xml
+++ b/soong_workflow/views/soong_workflow_record.xml
@@ -24,7 +24,7 @@
soong.workflow.record
@@ -40,6 +40,7 @@
+
@@ -118,6 +119,7 @@
ir.actions.act_window
soong.workflow.record
tree,kanban,search
+ {'check_employee': 1}
[('employee_ids.user_id', '=', uid), ('reclaim_state', '=', False)]
diff --git a/yuthon_holiday/views/yuthon_vacation_reports_views.xml b/yuthon_holiday/views/yuthon_vacation_reports_views.xml
index 63fc31798..023f3718d 100644
--- a/yuthon_holiday/views/yuthon_vacation_reports_views.xml
+++ b/yuthon_holiday/views/yuthon_vacation_reports_views.xml
@@ -63,7 +63,7 @@
假期报表
yuthon.vacation.reports
- tree
+ tree,form
更新报表
diff --git a/yuthon_hr_employee/models/yuthon_hr_employee.py b/yuthon_hr_employee/models/yuthon_hr_employee.py
index 4da1bb207..df117e5c1 100644
--- a/yuthon_hr_employee/models/yuthon_hr_employee.py
+++ b/yuthon_hr_employee/models/yuthon_hr_employee.py
@@ -509,36 +509,17 @@ class YuthonHrEmployee(models.Model):
domain = expression.AND([search_domain, domain])
return self._search(domain, limit=limit, order=order)
- def put_overtime_return(self):
- uid = self.user_id.id
- action = {
- 'name': '加班详情',
- 'type': 'ir.actions.act_window',
- 'res_model': 'overtime.approval',
- 'view_mode': 'tree',
- 'domain': [('users_id', '=', uid)],
- }
- return action
- def put_batch_return(self):
- uid = self.user_id.id
- action = {
- 'type': 'ir.actions.act_window',
- 'res_model': 'hr.leave.batch',
- 'view_mode': 'tree',
- 'domain': [('users_id', '=', uid)],
- }
- return action
-
- def put_holiday_return(self):
- employee_id = self.user_id.employee_id.id
- action = {
- 'name': '请假详情',
- 'type': 'ir.actions.act_window',
- 'res_model': 'hr.leave',
- 'view_mode': 'tree',
- 'domain': [('employee_id', '=', employee_id)],
- }
- return action
+ def employee_log(self):
+ vacation_id = self.env['yuthon.vacation.reports'].search([('employee_id', '=', self.id)])
+ if vacation_id:
+ return {
+ 'name': '休假记录',
+ 'type': 'ir.actions.act_window',
+ 'res_model': 'yuthon.vacation.reports',
+ 'view_mode': 'form',
+ 'res_id': vacation_id.id,
+ 'target': 'new'
+ }
diff --git a/yuthon_hr_employee/views/yuthon_hr_employee_views.xml b/yuthon_hr_employee/views/yuthon_hr_employee_views.xml
index 886b50449..ba654071a 100644
--- a/yuthon_hr_employee/views/yuthon_hr_employee_views.xml
+++ b/yuthon_hr_employee/views/yuthon_hr_employee_views.xml
@@ -9,6 +9,9 @@
0
+
+
+
上级领导
"{'no_create': True}"
@@ -165,9 +168,6 @@
-
-
-
@@ -184,9 +184,6 @@
-
-
-
@@ -205,9 +202,6 @@
-
-
-
diff --git a/yuthon_property/views/menuitem.xml b/yuthon_property/views/menuitem.xml
index d69993fd1..27795ee36 100644
--- a/yuthon_property/views/menuitem.xml
+++ b/yuthon_property/views/menuitem.xml
@@ -114,12 +114,12 @@
sequence="10"
name="电表库"
parent="yuthon_property_archives_setting_meu"
- action="action_property_meter_archives"/>
+ action="yuthon_property_approval.action_property_meter_archives"/>
+ action="yuthon_property_approval.action_property_meter_water"/>
+
-
+
-