List the child tasks of a parent work order.
(
wonum: str, site_id: str
)
| 142 | |
| 143 | |
| 144 | async def get_workorder_tasks( |
| 145 | wonum: str, site_id: str |
| 146 | ) -> Union[TasksResult, ErrorResult]: |
| 147 | """List the child tasks of a parent work order.""" |
| 148 | res = await wo.get_workorder_tasks(db(), wonum, site_id) |
| 149 | err = _failed(res) |
| 150 | if err: |
| 151 | return err |
| 152 | d = res["data"] |
| 153 | tasks = [WorkOrderItem.model_validate(t) for t in d["tasks"]] |
| 154 | return TasksResult( |
| 155 | parent_wonum=d["parent_wonum"], |
| 156 | site_id=d["site_id"], |
| 157 | total=len(tasks), |
| 158 | tasks=tasks, |
| 159 | message=f"{len(tasks)} task(s) under {wonum}.", |
| 160 | ) |
| 161 | |
| 162 | |
| 163 | async def get_workorder_costs( |
nothing calls this directly
no test coverage detected