Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: 单据撤销&终止回调去除事务 #1246

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions itsm/ticket/models/ticket.py
Original file line number Diff line number Diff line change
Expand Up @@ -2975,6 +2975,7 @@ def set_finished(
ticket, message, operator, detail_message=desc
)

self.close_moa_ticket(operator=operator)
self.callback_request()

def get_last_approver(self):
Expand Down Expand Up @@ -4239,8 +4240,8 @@ def close(self, close_status, desc="", operator=""):
self.do_before_end_pipeline(operator, close_status, desc, source=WEB)
# 直接终止后台流程
task_service.revoke_pipeline(self.id)

self.stop_all_sla()

return

def do_before_end_pipeline(
Expand Down Expand Up @@ -4397,16 +4398,17 @@ def terminate(self, state_id, operator="", terminate_message="--"):
name=node_status.name,
detail_message=terminate_message,
)
self.close_moa_ticket(state_id, operator)
self.callback_request()
self.notify(
state_id=state_id,
receivers=self.creator,
message=message,
action=TERMINATE_OPERATE,
retry=False,
)
# 终止单据关闭所有待办
self.close_moa_ticket(operator)

self.callback_request()
self.notify(
state_id=state_id,
receivers=self.creator,
message=message,
action=TERMINATE_OPERATE,
retry=False,
)
self.stop_all_sla()

return {"result": True, "message": _("流程终止成功:%s") % res.message, "code": 0}
Expand Down Expand Up @@ -4479,7 +4481,6 @@ def withdraw(self, operator, source):
node_status = self.status(state_id)

message = "{operator} 撤销单据."

with transaction.atomic():
end_at = datetime.now()
node_status.set_status(TERMINATED, operator, terminate_message=message)
Expand All @@ -4502,11 +4503,10 @@ def withdraw(self, operator, source):

# 更新状态
self.update_current_status("REVOKED")
self.close_moa_ticket(state_id, operator)
self.callback_request()

self.close_moa_ticket(operator=operator)
task_service.revoke_pipeline(self.id)
self.callback_request()
self.stop_all_sla()

# 撤销单据触发信号发送
self.send_trigger_signal(DELETE_TICKET)

Expand Down
2 changes: 1 addition & 1 deletion platform_config/open/moa/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ class BaseMoaConfig:
def create_moa_ticket(self, state_id):
pass

def close_moa_ticket(self, state_id, operator):
def close_moa_ticket(self, state_id=None, operator=None):
pass
Loading