{"id":25171183,"url":"https://github.com/leshaunj/clo","last_synced_at":"2025-04-03T21:20:23.073Z","repository":{"id":200220018,"uuid":"705251734","full_name":"LeShaunJ/clo","owner":"LeShaunJ","description":"Perform API operations on Odoo instances from the command-line.","archived":false,"fork":false,"pushed_at":"2023-11-03T13:30:28.000Z","size":1228,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-09T12:47:48.990Z","etag":null,"topics":["api","cli","command-line-tool","external","odoo","python3","xmlrpc"],"latest_commit_sha":null,"homepage":"https://leshaunj.github.io/clo/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LeShaunJ.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null}},"created_at":"2023-10-15T13:48:52.000Z","updated_at":"2024-05-01T14:09:50.000Z","dependencies_parsed_at":"2023-10-27T23:25:23.979Z","dependency_job_id":"f2313504-2bba-4c61-b2af-601278fcf7ef","html_url":"https://github.com/LeShaunJ/clo","commit_stats":null,"previous_names":["leshaunj/clo"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeShaunJ%2Fclo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeShaunJ%2Fclo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeShaunJ%2Fclo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeShaunJ%2Fclo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LeShaunJ","download_url":"https://codeload.github.com/LeShaunJ/clo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247079125,"owners_count":20880001,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","cli","command-line-tool","external","odoo","python3","xmlrpc"],"created_at":"2025-02-09T09:19:30.500Z","updated_at":"2025-04-03T21:20:23.048Z","avatar_url":"https://github.com/LeShaunJ.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CLO (Command-Line Odoo)\n\n[![Build Status][build_status_badge]][build_status_link]\n[![Coverage][coverage_badge]][coverage_link]\n[![PyPI version][pypi_badge]][pypi_link]\n\nPerform API operations on Odoo instances via the command-line.\n\n## Contents\n\n* [Installation](#installation)\n* [Usage](#usage)\n  * [Globals](#globals)\n    * [Options](#options)\n    * [Requisites](#requisites)\n  * [Actions](#actions)\n    * [Search](#search)\n    * [Count](#count)\n    * [Read](#read)\n    * [Find](#find)\n    * [Create](#create)\n    * [Write](#write)\n    * [Delete](#delete)\n    * [Fields](#fields)\n    * [Explain](#explain)\n  * [Concepts](#concepts)\n* [See Also](#see-also)\n\n## Installation\n\n```sh\npip3 install clo\n```\n\n## Usage\n\n```sh\nclo [OPTIONS] ACTION ...\n```\n\n### Globals\n\nThe following parameters apply to any [Action](#actions).\n\n#### Options\n\n| Flag(s) | Argument | Required | Description                                                                         . | Default |\n| :--- | :--: | :--: | :--- | :--- |\n| `‑‑model`\u003cbr\u003e`‑m` | `MODEL` | NO | The Odoo model to perform an action on. Run `clo explain models [-v]` to list                             available options. | `\"res.users\"` |\n| `‑‑env` | `FILE` | NO | Path to a `.clorc` file. See [Requisites](#requisites) below for details. | `\".clorc\"` |\n| `‑‑inst`\u003cbr\u003e`‑‑instance` | `URL` | NO | The address of the Odoo instance. See [Requisites](#requisites) below for details. |  |\n| `‑‑db`\u003cbr\u003e`‑‑database` | `NAME` | NO | The application database to perform operations on. See [Requisites](#requisites) below                             for details. |  |\n| `‑‑user` | `NAME` | NO | The user to perform operations as. See [Requisites](#requisites) below for details. |  |\n| `‑‑demo` | `FILE` | NO | Generate a demo instance from Odoo Cloud and save the connection properties to `FILE`. | `\".clorc\"` |\n| `‑‑out` | `FILE` | NO | Where to stream the output. |  |\n| `‑‑log` | `LEVEL` | NO | The level (_`OFF`, `FATAL`, `ERROR`, `WARN`, `INFO`, `DEBUG`, `TRACE`_) of logs to produce. | `\"WARN\"` |\n| `‑‑dry‑run` |  | NO | Perform a \"practice\" run of the action; implies `--log=DEBUG`. | `false` |\n| `‑‑help`\u003cbr\u003e`‑h` |  | NO | Show this help message and exit. |  |\n| `‑‑version` |  | NO | Show version of this program. |  |\n\n\u003e #### Requisites\n\u003e \n\u003e \n\u003e The following inputs are **required**, but have multiple or special specifications. In the absense of these inputs, the program will ask for input:\n\u003e \n\u003e - `--instance` can be specified using environment variable **`CLO_INSTANCE`**.\n\u003e - `--database` can be specified using environment variable **`CLO_DATABASE`**.\n\u003e - `--username` can be specified using environment variable **`CLO_USERNAME`**.\n\u003e - The `password` (_or `API-key`_) **MUST BE** specified using environment variable **`CLO_PASSWORD`**.\n\u003e \n\u003e `clo` also looks for a `.clorc` file in the working directory that contain these values, or the file specified by `--env FILE`, if it exists.\n### Actions\n\nThe Odoo instance is queried, or operated on, using `ACTIONS`. Each `ACTION` has it's own set of arguements; run `clo ACTION --help` for specific details.\n\n#### Search\n\n```sh\nclo [OPTIONS] ACTION ... search [[-o|-n|-a] -d FIELD OPERATOR VALUE [-d ...]] [--offset POSITION] [--limit AMOUNT] [--order FIELD] [--count] [-h]\n```\n\nSearches for record IDs based on the search domain.\n\n##### Options\n\n| Flag(s) | Argument | Required | Description                                                                         . | Default |\n| :--- | :--: | :--: | :--- | :--- |\n| `‑‑domain`\u003cbr\u003e`‑d` | `FIELD`\u003cbr\u003e`OPERATOR`\u003cbr\u003e`VALUE` | NO | A set of criterion to filter the search by (_run `clo explain domains` for details_). This option can be specified multiple times. | `[]` |\n| `‑‑or`\u003cbr\u003e`‑o` |  | NO | A logical `OR`, placed before two or more domains (_arity 2_). Run `clo explain logic` for more details. |  |\n| `‑‑and`\u003cbr\u003e`‑a` |  | NO | A logical `AND` to place before two or more domains (_arity 2_). Run `clo explain logic` for more details. |  |\n| `‑‑not`\u003cbr\u003e`‑n` |  | NO | A logical `OR` to place before a signle domain (_arity 1_). Run `clo explain logic` for more details. |  |\n| `‑‑offset` | `POSITION` | NO | Number of results to ignore. | `0` |\n| `‑‑limit` | `AMOUNT` | NO | Maximum number of records to return. |  |\n| `‑‑order` | `FIELD` | NO | The field to sort the records by. |  |\n| `‑‑raw`\u003cbr\u003e`‑r` |  | NO | Format output as space-separated IDs rather than pretty JSON. | `false` |\n| `‑‑help`\u003cbr\u003e`‑h` |  | NO | Show this help message and exit. |  |\n\n#### Count\n\n```sh\nclo [OPTIONS] ACTION ... count [--domain FIELD OPERATOR VALUE] [--or] [--and] [--not] [--limit AMOUNT] [--help]\n```\n\nReturns the number of records in the current model matching the provided domain.\n\n##### Options\n\n| Flag(s) | Argument | Required | Description                                                                         . | Default |\n| :--- | :--: | :--: | :--- | :--- |\n| `‑‑domain`\u003cbr\u003e`‑d` | `FIELD`\u003cbr\u003e`OPERATOR`\u003cbr\u003e`VALUE` | NO | A set of criterion to filter the search by (_run `clo explain domains` for details_). This option can be specified multiple times. | `[]` |\n| `‑‑or`\u003cbr\u003e`‑o` |  | NO | A logical `OR`, placed before two or more domains (_arity 2_). Run `clo explain logic` for more details. |  |\n| `‑‑and`\u003cbr\u003e`‑a` |  | NO | A logical `AND` to place before two or more domains (_arity 2_). Run `clo explain logic` for more details. |  |\n| `‑‑not`\u003cbr\u003e`‑n` |  | NO | A logical `OR` to place before a signle domain (_arity 1_). Run `clo explain logic` for more details. |  |\n| `‑‑limit` | `AMOUNT` | NO | Maximum number of records to return. |  |\n| `‑‑help`\u003cbr\u003e`‑h` |  | NO | Show this help message and exit. |  |\n\n#### Read\n\n```sh\nclo [OPTIONS] ACTION ... read --ids ID [ID ...] [--fields FIELD [FIELD ...]] [--csv] [--help]\n```\n\nRetrieves the details for the records at the ID(s) specified.\n\n##### Options\n\n| Flag(s) | Argument | Required | Description                                                                         . | Default |\n| :--- | :--: | :--: | :--- | :--- |\n| `‑‑ids`\u003cbr\u003e`‑i` | `ID` | YES | The ID number(_s_) of the record(_s_) to perform the action on. Specifying `-` expects a space-separated list from STDIN. |  |\n| `‑‑fields`\u003cbr\u003e`‑f` | `FIELD` | NO | Field names to return (_default is all fields_). | `[]` |\n| `‑‑csv` |  | NO | If `True`, outputs records in CSV format. | `false` |\n| `‑‑help`\u003cbr\u003e`‑h` |  | NO | Show this help message and exit. |  |\n\n#### Find\n\n```sh\nclo [OPTIONS] ACTION ... find [[-o|-n|-a] -d FIELD OPERATOR VALUE [-d ...]] [-f FIELD ...] [--offset POSITION] [--limit AMOUNT] [--order FIELD] [--csv [FILE]] [--help]\n```\n\nA shortcut that combines `search` and `read` into one execution.\n\n##### Options\n\n| Flag(s) | Argument | Required | Description                                                                         . | Default |\n| :--- | :--: | :--: | :--- | :--- |\n| `‑‑domain`\u003cbr\u003e`‑d` | `FIELD`\u003cbr\u003e`OPERATOR`\u003cbr\u003e`VALUE` | NO | A set of criterion to filter the search by (_run `clo explain domains` for details_). This option can be specified multiple times. | `[]` |\n| `‑‑or`\u003cbr\u003e`‑o` |  | NO | A logical `OR`, placed before two or more domains (_arity 2_). Run `clo explain logic` for more details. |  |\n| `‑‑and`\u003cbr\u003e`‑a` |  | NO | A logical `AND` to place before two or more domains (_arity 2_). Run `clo explain logic` for more details. |  |\n| `‑‑not`\u003cbr\u003e`‑n` |  | NO | A logical `OR` to place before a signle domain (_arity 1_). Run `clo explain logic` for more details. |  |\n| `‑‑fields`\u003cbr\u003e`‑f` | `FIELD` | NO | Field names to return (_default is all fields_). | `[]` |\n| `‑‑offset` | `POSITION` | NO | Number of results to ignore. | `0` |\n| `‑‑limit` | `AMOUNT` | NO | Maximum number of records to return. |  |\n| `‑‑order` | `FIELD` | NO | The field to sort the records by. |  |\n| `‑‑csv` |  | NO | If `True`, outputs records in CSV format. | `false` |\n| `‑‑help`\u003cbr\u003e`‑h` |  | NO | Show this help message and exit. |  |\n\n#### Create\n\n```sh\nclo [OPTIONS] ACTION ... create --value FIELD VALUE [--help]\n```\n\nCreates new records in the current model.\n\n##### Options\n\n| Flag(s) | Argument | Required | Description                                                                         . | Default |\n| :--- | :--: | :--: | :--- | :--- |\n| `‑‑value`\u003cbr\u003e`‑v` | `FIELD`\u003cbr\u003e`VALUE` | YES | Key/value pair(_s_) that correspond to the field and assigment to be made, respectively. |  |\n| `‑‑help`\u003cbr\u003e`‑h` |  | NO | Show this help message and exit. |  |\n\n#### Write\n\n```sh\nclo [OPTIONS] ACTION ... write --ids ID [ID ...] --value FIELD VALUE [--help]\n```\n\nUpdates existing records in the current model.\n\n##### Options\n\n| Flag(s) | Argument | Required | Description                                                                         . | Default |\n| :--- | :--: | :--: | :--- | :--- |\n| `‑‑ids`\u003cbr\u003e`‑i` | `ID` | YES | The ID number(_s_) of the record(_s_) to perform the action on. Specifying `-` expects a space-separated list from STDIN. |  |\n| `‑‑value`\u003cbr\u003e`‑v` | `FIELD`\u003cbr\u003e`VALUE` | YES | Key/value pair(_s_) that correspond to the field and assigment to be made, respectively. |  |\n| `‑‑help`\u003cbr\u003e`‑h` |  | NO | Show this help message and exit. |  |\n\n#### Delete\n\n```sh\nclo [OPTIONS] ACTION ... delete --ids ID [ID ...] [--help]\n```\n\nDeletes the records from the current model.\n\n##### Options\n\n| Flag(s) | Argument | Required | Description                                                                         . | Default |\n| :--- | :--: | :--: | :--- | :--- |\n| `‑‑ids`\u003cbr\u003e`‑i` | `ID` | YES | The ID number(_s_) of the record(_s_) to perform the action on. Specifying `-` expects a space-separated list from STDIN. |  |\n| `‑‑help`\u003cbr\u003e`‑h` |  | NO | Show this help message and exit. |  |\n\n#### Fields\n\n```sh\nclo [OPTIONS] ACTION ... fields [--attributes NAME [NAME ...]] [--help]\n```\n\nRetrieves raw details of the fields available in the current model.\nFor user-friendly formatting, run `clo [OPTIONS] ACTION ... fields explain fields`.\n\n##### Options\n\n| Flag(s) | Argument | Required | Description                                                                         . | Default |\n| :--- | :--: | :--: | :--- | :--- |\n| `‑‑attributes`\u003cbr\u003e`‑‑attr`\u003cbr\u003e`‑a` | `NAME` | NO | Attribute(_s_) to return for each field, all if empty or not provided. |  |\n| `‑‑help`\u003cbr\u003e`‑h` |  | NO | Show this help message and exit. |  |\n\n#### Explain\n\n```sh\nclo [OPTIONS] ACTION ... explain [--verbose] [--help] {models,domains,logic,fields}\n```\n\nDisplay documentation on a specified topic.\n\n##### Positional\n\n| Argument | Required | Description                                                                         . | Default |\n| :--- | :--: | :--- | :--- |\n| `{models,domains,logic,fields}` | YES | A topic to get further explanation on. |  |\n\n##### Options\n\n| Flag(s) | Argument | Required | Description                                                                         . | Default |\n| :--- | :--: | :--: | :--- | :--- |\n| `‑‑verbose`\u003cbr\u003e`‑v` |  | NO | Display more details. | `false` |\n| `‑‑help`\u003cbr\u003e`‑h` |  | NO | Show this help message and exit. |  |\n\n### Concepts\n\nThe following breakdowns apply to search-style `ACTIONS`.\n\n\n#### DOMAINS\n\nA domain is a set of criteria, each criterion being a throuple of `(FIELD, OPERATOR, VALUE)` where:\n\n`FIELD`:      A field name of the current model, or a relationship traversal through a `Many2one`\n              using dot-notation.\n\n`OPERATOR`:   An operand used to compare the `FIELD` with the value. Valid operators are:\n\n              =, !=, \u003e, \u003e=, \u003c, \u003c=   Standard comparison operators.\n\n              =?                    Unset or equals to (_returns true if value is either None or\n                                    False, otherwise behaves like `=`_).\n\n              =[i]like              Matches `FIELD` against the value pattern. An underscore (_`_`_)\n                                    in the pattern matches any single character; a percent sign\n                                    (_`%`_) matches any string of zero or more characters. `=ilike`\n                                    makes the search case-insensitive.\n\n              [not ][i]like         Matches (_or inverse-matches_) `FIELD` against the %value%\n                                    pattern. Similar to `=[i]like` but wraps value with `%` before\n                                    matching.\n\n              [not ]in              Is—or is not—equal to any of the items from value, value should\n                                    be a list of items.\n\n              child_of              Is a child (_descendant\u001b[2m_) of a value record (_\u001b[2mvalue can\n                                    be either one item or a list of items_). Takes the semantics\n                                    of the model into account (_i.e following the relationship\n                                    `FIELD` named by `VALUE`_).\n\n              parent_of             Is a child (_ascendant\u001b[2m_) of a value record (_\u001b[2mvalue can\n                                    be either one item or a list of items_). Takes the semantics\n                                    of the model into account (_i.e following the relationship\n                                    `FIELD` named by `VALUE`_).\n\n`VALUE`:      Variable type, must be comparable (_through `OPERATOR`_) to the named `FIELD`.\n\n#### LOGIC\n\nDomain criteria can be combined using logical operators in prefix form:\n\n    --or -d login = user -d name = \"John Smith\" -d email = user@domain.com\n\nis equivalent to `login == \"user\" || name == \"John Smith\" || email == \"user@domain.com\"`\n\n    --not -d login = user` or `-d login '!=' user\n\nare equivalent to `login != \"user\"`. `--not` is generally unneeded, save for negating the OPERATOR, `child_of`, or `parent_of`.\n\n    --and -d login = user -d name = \"John Smith\"\n\nis equivalent to `login == \"user\" \u0026\u0026 name == \"John Smith\"`; though, successive domainsimply `--and`.\n\n## See Also\n\n\n* [Changelog](https://github.com/LeShaunJ/clo/blob/main/CHANGELOG.md)\n* [Contributing](https://github.com/LeShaunJ/clo/blob/main/CONTRIBUTING.md)\n* [Code of Conduct](https://github.com/LeShaunJ/clo/blob/main/CODE_OF_CONDUCT.md)\n* [Security](https://github.com/LeShaunJ/clo/blob/main/SECURITY.md)\n\n![Banner][banner]\n\n[banner]: https://leshaunj.github.io/clo/assets/images/logo-social.png\n[build_status_badge]: https://github.com/LeShaunJ/clo/actions/workflows/test.yml/badge.svg\n[build_status_link]: https://github.com/LeShaunJ/clo/actions/workflows/test.yml\n[coverage_badge]: https://raw.githubusercontent.com/LeShaunJ/clo/main/docs/assets/images/coverage.svg\n[coverage_link]: https://raw.githubusercontent.com/LeShaunJ/clo/main/docs/assets/images/coverage.svg\n[pypi_badge]: https://badge.fury.io/py/clo.svg\n[pypi_link]: https://badge.fury.io/py/clo\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleshaunj%2Fclo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleshaunj%2Fclo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleshaunj%2Fclo/lists"}