diff --git a/sh_backmate_theme_adv_enterprise/controllers/home.py b/sh_backmate_theme_adv_enterprise/controllers/home.py index fab4f2328..4af9a6013 100644 --- a/sh_backmate_theme_adv_enterprise/controllers/home.py +++ b/sh_backmate_theme_adv_enterprise/controllers/home.py @@ -17,6 +17,7 @@ from odoo.addons.web.controllers.home import Home as WebHome MENU_BADGE_MODEL_FUNC_ENUM = { 'base.menu_action_res_users': {'model': 'file.preview.test', 'func': 'get_menu_badge_count'}, 'yuthon_notice.yuthon_notice_menu1': {'model': 'yuthon.notice', 'func': 'get_no_read_count'}, + 'purchase.purchase_order_view_tree': {'model': 'purchase.order', 'func': 'get_no_read_count'}, 'yuthon_property.yuthon_property_rent_list': {'model': 'property.rent.list', 'func': 'get_no_read_count'}, 'yuthon_property.yuthon_property_management_list': {'model': 'property.management.list', 'func': 'get_no_read_count'}, 'yuthon_property.yuthon_property_tariff_list': {'model': 'property.tariff.list', 'func': 'get_no_read_count'}, diff --git a/yuthon_hr_attendance/controllers/applet_attendance.py b/yuthon_hr_attendance/controllers/applet_attendance.py index b145c0f8a..19f4540ec 100644 --- a/yuthon_hr_attendance/controllers/applet_attendance.py +++ b/yuthon_hr_attendance/controllers/applet_attendance.py @@ -68,7 +68,16 @@ class AppletAttendance(Controller): } """ _logger.info("----------------/yuthon/att/today---------接口收到响应-------------------------------") + current_datetime = fields.Datetime.now() + timedelta(hours=8) current_date = fields.Date.today() + timedelta(hours=8) + + # 转换为字符串格式以便日志显示 + current_datetime_str = fields.Datetime.to_string(current_datetime) + current_date_str = fields.Date.to_string(current_datetime.date()) + + # 日志输出 + _logger.info(f'当前完整时间(含8小时偏移):{current_datetime_str}') + _logger.info(f'当前日期(含8小时偏移):{current_date_str}') user_id = request.env(user=SUPERUSER_ID)["res.users"].search([('id', '=', int(kw['user_id']))]) employee_id = request.env(user=SUPERUSER_ID)["hr.employee"].search([('name', '=', user_id.name)]) attendance_id = request.env(user=SUPERUSER_ID)["hr.attendance"].search( @@ -849,12 +858,25 @@ class AppletAttendance(Controller): 'code': 400, 'message': '参数不完整' }) - request.env['wifi.message'].sudo().create({ - 'mac': mac, - 'name': name, - 'bssid': bssid, - 'company_id': company_id - }) + + wifi_message = request.env['wifi.message'].sudo().search([ + ('mac', '=', mac), + ('bssid', '=', bssid), + ('company_id', '=', company_id) + ], limit=1) + + if wifi_message: + wifi_message.sudo().write({ + 'name': name, + }) + else: + request.env['wifi.message'].sudo().create({ + 'mac': mac, + 'name': name, + 'bssid': bssid, + 'company_id': company_id + }) + return json.dumps({ 'code': 200, 'message': '成功' @@ -885,14 +907,27 @@ class AppletAttendance(Controller): 'code': 400, 'message': '参数不完整' }) - request.env['applet.address'].sudo().create({ - 'address_name': address_name, - 'address_name2': address_name2, - 'longitude': longitude, - 'latitude': latitude, - 'card_rice': card_rice, - 'company_id': company_id - }) + applet_address = request.env['applet.address'].sudo().search([ + ('address_name', '=', address_name), + ('longitude', '=', longitude), + ('latitude', '=', latitude), + ('company_id', '=', company_id) + ], limit=1) + + if applet_address: + applet_address.sudo().write({ + 'address_name2': address_name2, + 'card_rice': card_rice, + }) + else: + request.env['applet.address'].sudo().create({ + 'address_name': address_name, + 'address_name2': address_name2, + 'longitude': longitude, + 'latitude': latitude, + 'card_rice': card_rice, + 'company_id': company_id + }) return json.dumps({ 'code': 200, 'message': '成功' diff --git a/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py b/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py index 6d7f92359..a5010f2ba 100644 --- a/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py +++ b/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py @@ -122,37 +122,9 @@ class HrAttendanceDetail(models.Model): attendance.check_in = record.checkin_time attendance.check_out = record.checkin_time else: - local_start = datetime.combine(checkin_date, datetime.min.time()) - local_end = local_start + timedelta(days=1) - utc_start = local_start - timedelta(hours=8) - utc_end = local_end - timedelta(hours=8) - domain = [ - ("exception_type", "!=", "未打卡"), - ('employee_id', '=', record.employee_id.id), - ('checkin_time', '>=', fields.Datetime.to_string(utc_start)), - ('checkin_time', '<', fields.Datetime.to_string(utc_end)) - ] - check_in = None - check_out = None - attendance_records = self.env['hr.attendance.detail'].search(domain) - if attendance_records: - checkin_times = sorted(attendance_records.mapped('checkin_time')) - check_in = checkin_times[0] - if len(checkin_times) == 1: - check_out = 0 - else: - check_out = checkin_times[-1] - if check_in is not None: - attendance.create({ - 'employee_id': record.employee_id.id, - 'check_in': check_in, - 'check_out': check_out, - 'current_data': checkin_date, - }) - - # now_time = fields.Datetime.to_datetime(checkin_date) + timedelta(hours=8, days=1) - # start_time = now_time - timedelta(days=2) - # self.env["hr.attendance.detail"].get_hr_attendance_time(record.employee_id, now_time, start_time) + now_time = fields.Datetime.to_datetime(checkin_date) + timedelta(hours=8, days=1) + start_time = now_time - timedelta(days=2) + self.env["hr.attendance.detail"].get_hr_attendance_time(record.employee_id, now_time, start_time) diff --git a/yuthon_property_approval/views/property_lease_contract.xml b/yuthon_property_approval/views/property_lease_contract.xml index d3c4282c9..a2668a6f9 100644 --- a/yuthon_property_approval/views/property_lease_contract.xml +++ b/yuthon_property_approval/views/property_lease_contract.xml @@ -36,10 +36,13 @@ invisible="condition != 'approval'"/> - + + + + @@ -65,7 +68,7 @@ - + @@ -85,7 +88,7 @@ - +