From fdcf3434fd0e753f0880615502cfdffb89d7d77e Mon Sep 17 00:00:00 2001
From: zhou <123@>
Date: Sat, 26 Jul 2025 20:29:25 +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/hr_attendance_detail_wechat.py | 4 +-
.../views/hr_attendance_views.xml | 2 +-
.../models/yuthon_resource_mgmt_config.py | 4 +-
.../views/yuthon_property_views.xml | 2 +-
.../yuthon_resource_mgmt_config_views.xml | 3 +-
.../wizard/yuthon_property_wizard.py | 60 ++++++++++++-------
6 files changed, 47 insertions(+), 28 deletions(-)
diff --git a/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py b/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py
index c8d23e5d8..ff672161b 100644
--- a/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py
+++ b/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py
@@ -451,7 +451,7 @@ class HrAttendanceDetail(models.Model):
# 上班
attendance_detail_obj_in = self.env['hr.attendance.detail'].sudo().search(
[("exception_type", "!=", "未打卡"),
- ("userid", "=", user.oauth_uid),
+ ("employee_id", "=", user.employee_id.id),
("checkin_time", ">=", check_in_start),
("checkin_time", "<=", check_in_end)])
if len(attendance_detail_obj_in) > 0:
@@ -474,7 +474,7 @@ class HrAttendanceDetail(models.Model):
# 下班
attendance_detail_obj_out = self.env['hr.attendance.detail'].sudo().search(
[("exception_type", "!=", "未打卡"),
- ("userid", "=", user.oauth_uid),
+ ("employee_id", "=", user.employee_id.id),
("checkin_time", ">=", check_out_start),
("checkin_time", "<=", check_out_end),
])
diff --git a/yuthon_hr_attendance/views/hr_attendance_views.xml b/yuthon_hr_attendance/views/hr_attendance_views.xml
index 582e7afba..bcbf23acc 100644
--- a/yuthon_hr_attendance/views/hr_attendance_views.xml
+++ b/yuthon_hr_attendance/views/hr_attendance_views.xml
@@ -15,12 +15,12 @@
+
-
diff --git a/yuthon_property/models/yuthon_resource_mgmt_config.py b/yuthon_property/models/yuthon_resource_mgmt_config.py
index 2c134c700..6b4f41612 100644
--- a/yuthon_property/models/yuthon_resource_mgmt_config.py
+++ b/yuthon_property/models/yuthon_resource_mgmt_config.py
@@ -215,8 +215,10 @@ class PropertyFloorSetting(models.Model):
_name = 'property.floor.setting'
_description = '楼层配置'
_order = 'first_letter'
+ _rec_name = 'show_name'
- name = fields.Char('名称', required=True)
+ name = fields.Char('名称')
+ show_name = fields.Char('名称', required=True)
parent_id = fields.Many2one('property.floor.setting', string='父级')
child_ids = fields.One2many('property.floor.setting', 'parent_id', string='子级')
type = fields.Selection([('floor', '楼层'), ('building', '楼盘')], string='类型')
diff --git a/yuthon_property/views/yuthon_property_views.xml b/yuthon_property/views/yuthon_property_views.xml
index 7db17018d..2c9e0defb 100644
--- a/yuthon_property/views/yuthon_property_views.xml
+++ b/yuthon_property/views/yuthon_property_views.xml
@@ -67,7 +67,7 @@
-
+
diff --git a/yuthon_property/views/yuthon_resource_mgmt_config_views.xml b/yuthon_property/views/yuthon_resource_mgmt_config_views.xml
index 834114ea3..4b4dc5b27 100644
--- a/yuthon_property/views/yuthon_resource_mgmt_config_views.xml
+++ b/yuthon_property/views/yuthon_resource_mgmt_config_views.xml
@@ -346,7 +346,8 @@
property.floor.setting
-
+
+
diff --git a/yuthon_property/wizard/yuthon_property_wizard.py b/yuthon_property/wizard/yuthon_property_wizard.py
index 4dc154a4e..2ac8cdd97 100644
--- a/yuthon_property/wizard/yuthon_property_wizard.py
+++ b/yuthon_property/wizard/yuthon_property_wizard.py
@@ -3,6 +3,7 @@ from odoo import models, fields, api, _, SUPERUSER_ID
from odoo.exceptions import ValidationError, UserError
from pypinyin import pinyin, Style
import xlrd
+import ast
import base64
import datetime
from datetime import datetime
@@ -182,31 +183,46 @@ class YuthonPropertyWizard(models.Model):
'company_id': company_id.id,})
- def yuthon_premises_id(self,row):
+ def yuthon_property_update2(self,row):
property_id = self.env['yuthon.property'].search([('name', '=', row[0].value)])
- premises_id = self.env['yuthon.premises.setting'].search([('name', '=', row[1].value)])
- property_floor_id = self.env['property.floor.setting'].search([('name', '=', row[4].value)])
- if not premises_id:
- premises_id = self.env['yuthon.premises.setting'].create({
- 'name': row[1].value,
- })
- if not property_floor_id:
- property_floor_id = self.env['property.floor.setting'].create({
- 'name': row[4].value,
- })
- if property_id:
- property_id.write({
- 'premises_id': premises_id.id,
- 'property_floor_id': property_floor_id.id,
- })
+ property_building_id = self.env['property.floor.setting'].search([('name', '=', row[1].value)])
+ property_floor_id = self.env['property.floor.setting'].search([('name', '=', row[2].value)])
+ property_id.write({
+ 'property_building_id': property_building_id.id,
+ 'property_floor_id': property_floor_id.id,
+ })
- def update_property(self,row):
- property_floor_id = self.env['property.floor.setting'].search([('name', '=', row[0].value)])
- if not property_floor_id:
- self.env['property.floor.setting'].create({
- 'name': row[0].value,
- 'type': row[1].value
+
+ def update_property(self, row):
+ """处理楼盘和楼层数据,建立父子关系"""
+ building_name = row[0].value
+ building = self.env['property.floor.setting'].search([
+ ('name', '=', building_name),
+ ('type', '=', 'building')
+ ], limit=1)
+ if not building:
+ building = self.env['property.floor.setting'].create({
+ 'name': building_name,
+ 'show_name': building_name,
+ 'type': 'building'
})
+ floor_list_str = row[1].value.strip()
+ floor_list = ast.literal_eval(floor_list_str)
+ for floor_show_name in floor_list:
+ floor_name = f"{building_name}-{floor_show_name}"
+ floor = self.env['property.floor.setting'].search([
+ ('name', '=', floor_name),
+ ('type', '=', 'floor'),
+ ('parent_id', '=', building.id)
+ ], limit=1)
+ if not floor:
+ floor = self.env['property.floor.setting'].create({
+ 'name': floor_name,
+ 'show_name': floor_show_name,
+ 'type': 'floor',
+ 'parent_id': building.id
+ })
+
def update_property1(self,row):
building = self.env['property.floor.setting'].search([('name', '=', row[1].value)])