Skip to content

Commit

Permalink
Merge pull request #1246 from hanshuaikang/feature/develop_by_han
Browse files Browse the repository at this point in the history
bugfix: 单据撤销&终止回调去除事务
  • Loading branch information
hanshuaikang authored Dec 19, 2023
2 parents ed08162 + 3e751eb commit ab593a7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
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

0 comments on commit ab593a7

Please sign in to comment.