diff --git a/soong_workflow/models/soong_workflow_mixin.py b/soong_workflow/models/soong_workflow_mixin.py index ec637b159..18c9d7d4d 100644 --- a/soong_workflow/models/soong_workflow_mixin.py +++ b/soong_workflow/models/soong_workflow_mixin.py @@ -340,18 +340,28 @@ class SoongWorkflowMixin(models.AbstractModel): btn for btn in next_node.button_ids if btn.name == '转交' ] - # 判断按钮隐藏条件 如果没有可用的就跳过 + has_visible_transfer_btn = True + # 判断按钮隐藏条件 如果没有可用的就跳过(说明流程最后一步) if not transfer_buttons: has_visible_transfer_btn = True else: - has_visible_transfer_btn = any( - not btn.invisible_expression or - self.search(eval(btn.invisible_expression)) - for btn in transfer_buttons - ) + for btn in transfer_buttons: + if btn.is_review_invisible: + domain = eval(btn.invisible_expression) + expression_result = self.search(domain) + has_self_in_result = self.id in expression_result.ids + if has_self_in_result: + has_visible_transfer_btn = True + break + else: + has_visible_transfer_btn = False + else: + has_visible_transfer_btn = True + if not has_visible_transfer_btn: skipped_node_names.append(next_node.name) _logger.info(f"跳过节点: {next_node.name},无可见的转交按钮") + # 更新索引 index = state_list.index(matched_key) if index >= len(node_list): diff --git a/soong_workflow/wizard/soong_workflow_comment_wizard.py b/soong_workflow/wizard/soong_workflow_comment_wizard.py index 3a7cf858c..e6d1ea072 100644 --- a/soong_workflow/wizard/soong_workflow_comment_wizard.py +++ b/soong_workflow/wizard/soong_workflow_comment_wizard.py @@ -154,6 +154,8 @@ class SoongWorkflowCommentWizard(models.TransientModel): for record in self: if not record.trans_link_id: continue + available_links = self.env['trans.link'].search([]) + record.invalid_link_ids = available_links[1:] record_id = self.env[record.res_model].browse(record.res_id) if record.res_model and record.res_id else None for link in record.trans_link_id: employee_user_role_ids = self._get_approvers_for_link(link, record_id) diff --git a/yuthon_hr_attendance/controllers/applet_attendance.py b/yuthon_hr_attendance/controllers/applet_attendance.py index 460f5ee79..7d8b436e0 100644 --- a/yuthon_hr_attendance/controllers/applet_attendance.py +++ b/yuthon_hr_attendance/controllers/applet_attendance.py @@ -121,7 +121,7 @@ class AppletAttendance(Controller): '缺卡'] else f'
{check_out_str}
' state = "no" message = "超出范围或wifi未连接,不允许打卡" - address_ids = request.env(user=SUPERUSER_ID)["applet.address"].search([]) + address_ids = request.env(user=SUPERUSER_ID)["applet.address"].search([('company_id', '=', employee_id.company_id.id)]) if kw['att_latitude'] != kw['att_longitude']: self_address = self.get_address_from_coords(kw['att_latitude'], kw['att_longitude']) else: @@ -301,7 +301,7 @@ class AppletAttendance(Controller): 'checkin_type': checkin_type, 'sch_checkin_time': sch_checkin_time, }) - now_time = fields.Datetime.to_datetime(fields.Date.today()) + timedelta(hours=8, days=1) + now_time = fields.Datetime.to_datetime(fields.Date.today()) - timedelta(hours=8, days=1) start_time = now_time - timedelta(days=2) request.env["hr.attendance.detail"].get_hr_attendance_time(employee_id, now_time, start_time) return_data = {'code': '200', 'message': '打卡成功'} diff --git a/yuthon_hr_attendance/models/hr_attendance.py b/yuthon_hr_attendance/models/hr_attendance.py index 6eee1e0bf..c58649264 100644 --- a/yuthon_hr_attendance/models/hr_attendance.py +++ b/yuthon_hr_attendance/models/hr_attendance.py @@ -111,6 +111,25 @@ class HrAttendance(models.Model): else: record.company_id = False + def write(self, vals): + if 'check_out' in vals: + for record in self: + target_date = record.current_data + start_of_day = datetime.combine(target_date, datetime.min.time()) + end_of_day = start_of_day + timedelta(days=1) + start_str = fields.Datetime.to_string(start_of_day) + end_str = fields.Datetime.to_string(end_of_day) + detail_records = self.env['hr.attendance.detail'].search([ + ('employee_id', '=', record.employee_id.id), + ('checkin_time', '>=', start_str), + ('checkin_time', '<', end_str) + ]) + + if detail_records: + max_checkin_time = max(detail_records.mapped('checkin_time')) + vals['check_out'] = max_checkin_time + return super(HrAttendance, self).write(vals) + # @api.model # def web_read_group(self, domain, fields, groupby, limit=None, offset=0, orderby=False, lazy=True): # result = super().web_read_group(domain, fields, groupby, limit, offset, orderby, lazy) diff --git a/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py b/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py index 916eb03b1..f0149f2e0 100644 --- a/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py +++ b/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py @@ -113,19 +113,13 @@ class HrAttendanceDetail(models.Model): """同步打卡记录到hr.attendance 更新上下班打卡时间 """ checkin_date = fields.Date.from_string(record.checkin_time) attendance = self.env['hr.attendance'].search([ - ('employee_id', '=', record.employee_id.id), + ('employee_id.name', '=', '叶华锋'), ('current_data', '=', checkin_date) ], limit=1) if attendance: if not attendance.check_in: attendance.check_in = record.checkin_time - elif not attendance.check_out: - attendance.check_out = record.checkin_time - existing_checkout = fields.Datetime.from_string(attendance.check_out) - new_checkout = fields.Datetime.from_string(record.checkin_time) - # 只在新打卡时间更晚的情况下更新 - if not existing_checkout or new_checkout > existing_checkout: - attendance.check_out = record.checkin_time + attendance.check_out = record.checkin_time # 传参按一个人打卡一次传参 diff --git a/yuthon_official/__manifest__.py b/yuthon_official/__manifest__.py index 58f28df2e..ee81c1654 100644 --- a/yuthon_official/__manifest__.py +++ b/yuthon_official/__manifest__.py @@ -10,7 +10,7 @@ 'category': 'Human Resources/Attendances', 'version': '0.1', 'license': 'LGPL-3', - 'depends': ['mail', 'hr', 'soong_workflow', 'room', 'yuthon_issue'], + 'depends': ['mail', 'hr', 'soong_workflow', 'room', 'yuthon_issue', 'yuthon_trade'], 'data': [ 'data/official_type_data.xml', 'security/ir.model.access.csv', @@ -23,7 +23,7 @@ 'views/yuthon_official_incoming_labor_views.xml', 'views/yuthon_official_party_views.xml', 'views/yuthon_official_incoming_party_views.xml', - 'views/inherit_soong_workflow_insector_views.xml', + # 'views/inherit_soong_workflow_insector_views.xml', 'views/inherit_room_booking_views.xml', 'views/inherit_issue_library_views.xml', 'views/official_menus.xml', diff --git a/yuthon_official/views/official_menus.xml b/yuthon_official/views/official_menus.xml index a368a9d79..7cbfa5bed 100644 --- a/yuthon_official/views/official_menus.xml +++ b/yuthon_official/views/official_menus.xml @@ -1,97 +1,127 @@