Fix partner task execution context and installer verification
This commit is contained in:
@@ -193,10 +193,6 @@ def _task_label(task: ClientServiceTaskInstance) -> dict[str, Any]:
|
|||||||
catalogue = getattr(task, "catalogue", None)
|
catalogue = getattr(task, "catalogue", None)
|
||||||
assignee = getattr(task, "assigned_to", None)
|
assignee = getattr(task, "assigned_to", None)
|
||||||
status = (task.status or "pending").replace("_", " ").title()
|
status = (task.status or "pending").replace("_", " ").title()
|
||||||
status_code = (getattr(task, "status", None) or "pending").strip().lower()
|
|
||||||
is_locked = bool(getattr(task, "is_locked", False) or getattr(subscription, "is_locked", False))
|
|
||||||
is_task_assignee = int(getattr(task, "assigned_to_user_id", 0) or 0) == int(getattr(current_user, "id", 0) or 0)
|
|
||||||
can_execute = bool(is_task_assignee and not is_locked and status_code not in {"completed", "not_applicable"})
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"id": task.id,
|
"id": task.id,
|
||||||
@@ -512,6 +508,14 @@ def _partner_task_payload(task: ClientServiceTaskInstance, subscription: ClientS
|
|||||||
comments = [c for c in (getattr(task, "comments", None) or []) if not getattr(c, "is_deleted", False)]
|
comments = [c for c in (getattr(task, "comments", None) or []) if not getattr(c, "is_deleted", False)]
|
||||||
documents = [d for d in (getattr(task, "documents", None) or []) if not getattr(d, "is_deleted", False)]
|
documents = [d for d in (getattr(task, "documents", None) or []) if not getattr(d, "is_deleted", False)]
|
||||||
assignee = getattr(task, "assigned_to", None)
|
assignee = getattr(task, "assigned_to", None)
|
||||||
|
status_code = (getattr(task, "status", None) or "pending").strip().lower()
|
||||||
|
is_locked = bool(getattr(task, "is_locked", False) or getattr(subscription, "is_locked", False))
|
||||||
|
is_task_assignee = int(getattr(task, "assigned_to_user_id", 0) or 0) == int(getattr(current_user, "id", 0) or 0)
|
||||||
|
can_execute = bool(
|
||||||
|
is_task_assignee
|
||||||
|
and not is_locked
|
||||||
|
and status_code not in {"completed", "not_applicable"}
|
||||||
|
)
|
||||||
return {
|
return {
|
||||||
"id": task.id,
|
"id": task.id,
|
||||||
"task_name": task.task_name,
|
"task_name": task.task_name,
|
||||||
|
|||||||
Reference in New Issue
Block a user