From 0b268060464ca97f0d5fcc678ceb31900a50b8cf Mon Sep 17 00:00:00 2001 From: zhou <123@> Date: Sat, 5 Jul 2025 17:26:56 +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 --- soong_workflow/models/soong_workflow_mixin.py | 11 +----- .../controllers/applet_attendance.py | 39 +++++++++++-------- .../views/property_lease_contract.xml | 2 + 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/soong_workflow/models/soong_workflow_mixin.py b/soong_workflow/models/soong_workflow_mixin.py index 5aad64892..4a3959bba 100644 --- a/soong_workflow/models/soong_workflow_mixin.py +++ b/soong_workflow/models/soong_workflow_mixin.py @@ -17,11 +17,6 @@ class SoongWorkflowMixin(models.AbstractModel): _name = "soong.workflow.mixin" _description = "Soong Workflow Mixin" - def end_approval(self): - record = self.env['soong.workflow.record'].search([('code', '=', self.code)]) - if record: - record.write({'approve_state': 'end'}) - def read(self, fields=None, load='_classic_read'): if self.log_ids: if self.log_ids[-1].done_by.id == self.env.user.id and self.log_ids[-1].approval_state == '0': @@ -518,6 +513,7 @@ class SoongWorkflowMixin(models.AbstractModel): @api.model def get_view(self, view_id=None, view_type="form", **options): res = super().get_view(view_id, view_type, **options) + active_id = self._context.get('active_id') if '
{check_in_str}

' if check_in_status in ['迟到', '早退', '缺卡'] else f'

{check_in_str}

' check_out_html = f'

{check_out_str}

' if check_out_status in ['迟到', '早退', '缺卡'] else f'

{check_out_str}

' - if not self.is_within_radius_geopy(kw['att_latitude'], kw['att_longitude'], address_id.latitude, address_id.longitude, card_rice): - data = {"message": "超出范围,不允许打卡", 'state': 'no', 'state_result': '超出范围'} - _logger.info("-------触发超出范围,不允许打卡---------") - else: - data = {'location': '%s' % address_id.address_name, + self_address = self.get_address_from_coords(kw['att_latitude'], kw['att_longitude']) + _logger.info(f"打卡经度{kw['att_longitude'] }打卡纬度{kw['att_latitude']}__________") + _logger.info(f"人员{employee_id.name}地址{self_address['formatted_address']}__________") + address_ids = request.env(user=SUPERUSER_ID)["applet.address"].search([('address_name', '=', employee_id.company_id.name)]) + data = {"message": "超出范围,不允许打卡", 'state': 'no', 'state_result': '超出范围'} + for address_id in address_ids: + card_rice = address_id.card_rice * 0.001 + if self.is_within_radius_geopy( + kw['att_latitude'], + kw['att_longitude'], + address_id.latitude, + address_id.longitude, + card_rice + ): + data = { + 'location': '%s' % address_id.address_name, 'user_id': user_id.id, 'state': 'yes', 'class': [f"{attendance_id.shift_name}{start_time_str}-{end_time_str}"], @@ -91,7 +95,8 @@ class AppletAttendance(Controller): 'check_in_status': check_in_status, 'check_out': check_out_html, 'check_out_status': check_out_status, - }, + } + break return_data = {'data': data, 'code': '200', 'message': 'OK'} return json.dumps(return_data) @@ -185,7 +190,8 @@ class AppletAttendance(Controller): } """ _logger.info("----------------/yuthon/att/att---------接口收到响应-------------------------------") - user_id = int(kw['user_id']) + 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)]) month = kw['selected_month'] # 2015-01 year = int(month[0:4]) month = int(month[-2:]) @@ -202,7 +208,7 @@ class AppletAttendance(Controller): # 本月考勤记录 leave_days = 0 current_attendance = request.env(user=SUPERUSER_ID)['hr.attendance'].sudo().search([ - ('employee_id.user_id', '=', user_id), + ('employee_id', '=', employee_id.id), ('current_data', '>=', current_month_first.date()), ('current_data', '<=', current_month_last.date()), ('week', 'not in', ['seven', 'six']) @@ -245,7 +251,6 @@ class AppletAttendance(Controller): records = [] for att in attendances: # 获取班次信息 - shift_name = att.shift_id.name if att.shift_id else "" check_in_start = att.shift_id.template_id.check_in_start if att.shift_id and att.shift_id.template_id else 0 check_out_end = att.shift_id.template_id.check_out_end if att.shift_id and att.shift_id.template_id else 0 start_hour = int(check_in_start) @@ -270,7 +275,7 @@ class AppletAttendance(Controller): # 添加到记录列表 records.append({ 'date': att.current_data.strftime('%Y-%m-%d'), - 'class': [f"{shift_name}{standard_check_in_str}-{standard_check_out_str}"], + 'class': [f"{att.shift_name}{standard_check_in_str}-{standard_check_out_str}"], 'user_id': user_id, 'check_in': check_in_str, 'check_in_state': check_in_html, diff --git a/yuthon_property_approval/views/property_lease_contract.xml b/yuthon_property_approval/views/property_lease_contract.xml index 75229eede..204ef121a 100644 --- a/yuthon_property_approval/views/property_lease_contract.xml +++ b/yuthon_property_approval/views/property_lease_contract.xml @@ -809,6 +809,7 @@ 合同管理 property.lease.contract tree,form + {'search_default_group_by_admin_id': True} @@ -818,6 +819,7 @@ property.lease.contract tree,form [('condition', 'in', ['new', 'approval', 'cancel'])] + {'search_default_group_by_admin_id': True}