ppm_role_approve_and_activate
Approve and activate a role assignment in one step using its assignment ID.
Instructions
Approve and activate in one step.
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:334-340 (handler)The tool handler function for 'ppm_role_approve_and_activate'. It is decorated with @mcp.tool(), accepts an assignment_id (int), calls Odoo's 'action_approve_and_activate' on the 'ppm.role.assignment' model via the JSON-RPC client, and returns the record state.
@mcp.tool() def ppm_role_approve_and_activate(assignment_id: int) -> dict[str, Any]: """Approve and activate in one step.""" client().call_action( "ppm.role.assignment", "action_approve_and_activate", [assignment_id] ) return _read_state("ppm.role.assignment", assignment_id, _ROLE_FIELDS) - src/qod_ppm_mcp/server.py:334-334 (registration)The @mcp.tool() decorator on line 334 registers this function as an MCP tool named 'ppm_role_approve_and_activate' (derived from the function name).
@mcp.tool() - src/qod_ppm_mcp/server.py:30-34 (helper)The _read_state helper function used by the handler to read record fields after the action.
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:23-28 (helper)The client() helper that provides the OdooClient instance used to call the action and read state.
def client() -> OdooClient: global _client if _client is None: _client = OdooClient.from_env() return _client - src/qod_ppm_mcp/client.py:122-124 (helper)The call_action method on OdooClient that invokes the button/action method on Odoo records.
def call_action(self, model: str, method: str, ids: list[int]) -> Any: """Invoke an `action_*` button method on the given record ids.""" return self.execute_kw(model, method, [ids])