添加功能
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -798,12 +798,12 @@
|
||||
name="应收账单(明细)"
|
||||
parent="yuthon_financial_management_menu"
|
||||
action="yuthon_property_approval.property_accounts_receivable_action"/>
|
||||
<menuitem
|
||||
id="contract_accounts_receivable_menu"
|
||||
parent="yuthon_financial_management_menu"
|
||||
name="应收账单(合同)"
|
||||
action="yuthon_property_approval.view_contract_accounts_receivable_action"
|
||||
sequence="3"/>
|
||||
<!-- <menuitem-->
|
||||
<!-- id="contract_accounts_receivable_menu"-->
|
||||
<!-- parent="yuthon_financial_management_menu"-->
|
||||
<!-- name="应收账单(合同)"-->
|
||||
<!-- action="yuthon_property_approval.view_contract_accounts_receivable_action"-->
|
||||
<!-- sequence="3"/>-->
|
||||
<menuitem
|
||||
id="property_bills_payable_menu"
|
||||
parent="yuthon_financial_management_menu"
|
||||
|
||||
Reference in New Issue
Block a user