Work orders assigned to a given technician (labor code).
(
labor_code: str, site_id: Optional[str] = None, open_only: bool = True
)
| 217 | |
| 218 | |
| 219 | async def get_my_assigned_workorders( |
| 220 | labor_code: str, site_id: Optional[str] = None, open_only: bool = True |
| 221 | ) -> Union[WorkOrdersResult, ErrorResult]: |
| 222 | """Work orders assigned to a given technician (labor code).""" |
| 223 | res = await wo.get_my_assigned_workorders(db(), labor_code, site_id, open_only) |
| 224 | err = _failed(res) |
| 225 | if err: |
| 226 | return err |
| 227 | d = res["data"] |
| 228 | items = [WorkOrderItem.model_validate(x) for x in d["workorders"]] |
| 229 | return WorkOrdersResult( |
| 230 | site_id=site_id, |
| 231 | labor_code=labor_code, |
| 232 | total=d["totalCount"], |
| 233 | work_orders=items, |
| 234 | message=f"{d['totalCount']} work order(s) for {labor_code}.", |
| 235 | ) |
| 236 | |
| 237 | |
| 238 | async def generate_work_order( |
nothing calls this directly
no test coverage detected