diff --git a/soong_workflow/models/soong_workflow_mixin.py b/soong_workflow/models/soong_workflow_mixin.py
index 2c73dce71..199429be5 100644
--- a/soong_workflow/models/soong_workflow_mixin.py
+++ b/soong_workflow/models/soong_workflow_mixin.py
@@ -688,6 +688,7 @@ class SoongWorkflowMixin(models.AbstractModel):
form_el.insert(0, header_el)
# Construct Buttons & Fields Tags
wkf_rec = wkf_obj.search([("model_id", "=", model), ('is_enable', '=', True)])
+ force_hide_withdraw = False
for node in wkf_rec.node_ids:
for button in node.button_ids:
if self.env.user.has_group("soong_workflow.group_soong_workflow_manager"):
@@ -716,11 +717,13 @@ class SoongWorkflowMixin(models.AbstractModel):
elif button.review_type == "expression":
if not _check_condition_code(button):
continue
- # 如果是收回
- elif button.review_type == "withdraw":
- # 如果当前正在审批中或者审批完成的禁止收回
- if self.sudo().env["soong.workflow.log"].search([("workflow_id", "=", wkf_rec.id), ("node_id", "=", node.id), ("approval_state", "in", ["1", "2", "3"])]):
- continue
+ # 如果是收回
+ log_ids = self.sudo().env["soong.workflow.log"].search(
+ [("workflow_id", "=", wkf_rec.id),
+ ("node_id", "=", node.id)
+ ])
+ if log_ids and log_ids[-1].approval_state == '0':
+ force_hide_withdraw = True
# Add Button to View
btn_exec_action_el = etree.SubElement(header_el, "button")
btn_exec_action_el.set("name", "btn_exec_action")
@@ -768,16 +771,26 @@ class SoongWorkflowMixin(models.AbstractModel):
id_el.set("name", "approval_sign_ids")
id_el.set("invisible", "1")
invisible += " or uid not in approval_sign_ids"
- if button.name in ["退回", "结束", "收回"]:
+ if button.name in ["退回", "结束"]:
id_el = etree.Element("field")
id_el.set("name", "log_ids")
id_el.set("invisible", "1")
invisible += " or not log_ids "
+
+ if button.name == "收回":
+ id_el = etree.Element("field")
+ id_el.set("name", "log_ids")
+ id_el.set("invisible", "1")
+ invisible += " or not log_ids"
# if button.name == "结束":
# invisible += " or True"
invisible += " or work_end"
- btn_exec_action_el.set("invisible", invisible)
- btn_exec_action_el.set("context", "{'btn_key':'%s','active_model':'%s'}" % (button.btn_key, self._name),)
+ if force_hide_withdraw and button.name == "收回":
+ invisible += "1"
+ btn_exec_action_el.set("invisible", "1")
+ else:
+ btn_exec_action_el.set("invisible", invisible)
+ btn_exec_action_el.set("context", "{'btn_key':'%s','active_model':'%s'}" % (button.btn_key, self._name),)
res["arch"] = etree.tostring(arch, encoding="unicode").replace("\t", "")
return res
diff --git a/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py b/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py
index d864fb995..9779901fd 100644
--- a/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py
+++ b/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py
@@ -172,16 +172,20 @@ class HrAttendanceDetail(models.Model):
]
attendance_records = self.search(domain)
checkin_times = [rec.checkin_time + timedelta(hours=8) for rec in attendance_records if rec.checkin_time]
-
- check_in_start = self.float_to_datetime(current_data, template.check_in_start)
- check_in_end = self.float_to_datetime(current_data, template.check_in_end)
-
# 3. 确定有效上下班时间
+ check_in_end = self.float_to_datetime(current_data, template.check_in_end)
+ check_in_start = self.float_to_datetime(current_data, template.check_in_start)
+ if template.check_in_start > template.check_in_end:
+ valid_checkins = [
+ t for t in checkin_times
+ if check_in_end <= t <= check_in_start
+ ]
+ else:
+ valid_checkins = [
+ t for t in checkin_times
+ if check_in_start <= t <= check_in_end
+ ]
# 上班时间:在上班范围内的最小打卡时间
- valid_checkins = [
- t for t in checkin_times
- if check_in_start <= t <= check_in_end
- ]
check_in_time = min(valid_checkins) - timedelta(hours=8) if valid_checkins else None
check_out_start = self.float_to_datetime(current_data, template.check_out_start)
diff --git a/yuthon_work_brand/views/hr_menus.xml b/yuthon_work_brand/views/hr_menus.xml
index f141ced76..2cf0f87de 100644
--- a/yuthon_work_brand/views/hr_menus.xml
+++ b/yuthon_work_brand/views/hr_menus.xml
@@ -798,12 +798,12 @@
name="应收账单(明细)"
parent="yuthon_financial_management_menu"
action="yuthon_property_approval.property_accounts_receivable_action"/>
-
+
+
+
+
+
+