ppm_role_reset_draft
Resets a role assignment to its initial draft state to allow re-editing or re-approval.
Instructions
Return a role assignment to draft.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| assignment_id | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/qod_ppm_mcp/server.py:350-354 (handler)The handler function for the 'ppm_role_reset_draft' MCP tool. It is decorated with @mcp.tool(), takes an assignment_id integer, calls the Odoo server action 'action_reset_draft' on model 'ppm.role.assignment', and returns the updated state by reading the record fields.
@mcp.tool() def ppm_role_reset_draft(assignment_id: int) -> dict[str, Any]: """Return a role assignment to draft.""" client().call_action("ppm.role.assignment", "action_reset_draft", [assignment_id]) return _read_state("ppm.role.assignment", assignment_id, _ROLE_FIELDS) - src/qod_ppm_mcp/server.py:350-350 (registration)The tool is registered via the @mcp.tool() decorator from FastMCP, which exposes the function as an MCP tool named 'ppm_role_reset_draft'.
@mcp.tool() - src/qod_ppm_mcp/server.py:30-34 (helper)The _read_state helper reads a model record's fields after the action is performed, used by ppm_role_reset_draft to return the updated record.
def _read_state(model: str, rec_id: int, fields: list[str]) -> dict[str, Any]: rows = client().read(model, [rec_id], fields) if not rows: raise ValueError(f"{model} id={rec_id} not found") return rows[0] - src/qod_ppm_mcp/server.py:324-324 (schema)The _ROLE_FIELDS list defines the fields returned by ppm_role_reset_draft ('name', 'state', 'role_id', 'user_id', 'project_id', 'date_from', 'date_to').
_ROLE_FIELDS = ["name", "state", "role_id", "user_id", "project_id", "date_from", "date_to"]