# CLO (Command-Line Odoo)
[![Build Status][build_status_badge]][build_status_link]
[![Coverage][coverage_badge]][coverage_link]
[![PyPI version][pypi_badge]][pypi_link]
Perform API operations on Odoo instances via the command-line.
## Contents
* [Installation](#installation)
* [Usage](#usage)
* [Globals](#globals)
* [Options](#options)
* [Requisites](#requisites)
* [Actions](#actions)
* [Search](#search)
* [Count](#count)
* [Read](#read)
* [Find](#find)
* [Create](#create)
* [Write](#write)
* [Delete](#delete)
* [Fields](#fields)
* [Explain](#explain)
* [Concepts](#concepts)
* [See Also](#see-also)
## Installation
```sh
pip3 install clo
```
## Usage
```sh
clo [OPTIONS] ACTION ...
```
### Globals
The following parameters apply to any [Action](#actions).
#### Options
| Flag(s) | Argument | Required | Description . | Default |
| :--- | :--: | :--: | :--- | :--- |
| `‑‑model`<br>`‑m` | `MODEL` | NO | The Odoo model to perform an action on. Run `clo explain models [-v]` to list available options. | `"res.users"` |
| `‑‑env` | `FILE` | NO | Path to a `.clorc` file. See [Requisites](#requisites) below for details. | `".clorc"` |
| `‑‑inst`<br>`‑‑instance` | `URL` | NO | The address of the Odoo instance. See [Requisites](#requisites) below for details. | |
| `‑‑db`<br>`‑‑database` | `NAME` | NO | The application database to perform operations on. See [Requisites](#requisites) below for details. | |
| `‑‑user` | `NAME` | NO | The user to perform operations as. See [Requisites](#requisites) below for details. | |
| `‑‑demo` | `FILE` | NO | Generate a demo instance from Odoo Cloud and save the connection properties to `FILE`. | `".clorc"` |
| `‑‑out` | `FILE` | NO | Where to stream the output. | |
| `‑‑log` | `LEVEL` | NO | The level (_`OFF`, `FATAL`, `ERROR`, `WARN`, `INFO`, `DEBUG`, `TRACE`_) of logs to produce. | `"WARN"` |
| `‑‑dry‑run` | | NO | Perform a "practice" run of the action; implies `--log=DEBUG`. | `false` |
| `‑‑help`<br>`‑h` | | NO | Show this help message and exit. | |
| `‑‑version` | | NO | Show version of this program. | |
> #### Requisites
>
>
> The following inputs are **required**, but have multiple or special specifications. In the absense of these inputs, the program will ask for input:
>
> - `--instance` can be specified using environment variable **`CLO_INSTANCE`**.
> - `--database` can be specified using environment variable **`CLO_DATABASE`**.
> - `--username` can be specified using environment variable **`CLO_USERNAME`**.
> - The `password` (_or `API-key`_) **MUST BE** specified using environment variable **`CLO_PASSWORD`**.
>
> `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.
### Actions
The 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.
#### Search
```sh
clo [OPTIONS] ACTION ... search [[-o|-n|-a] -d FIELD OPERATOR VALUE [-d ...]] [--offset POSITION] [--limit AMOUNT] [--order FIELD] [--count] [-h]
```
Searches for record IDs based on the search domain.
##### Options
| Flag(s) | Argument | Required | Description . | Default |
| :--- | :--: | :--: | :--- | :--- |
| `‑‑domain`<br>`‑d` | `FIELD`<br>`OPERATOR`<br>`VALUE` | NO | A set of criterion to filter the search by (_run `clo explain domains` for details_). This option can be specified multiple times. | `[]` |
| `‑‑or`<br>`‑o` | | NO | A logical `OR`, placed before two or more domains (_arity 2_). Run `clo explain logic` for more details. | |
| `‑‑and`<br>`‑a` | | NO | A logical `AND` to place before two or more domains (_arity 2_). Run `clo explain logic` for more details. | |
| `‑‑not`<br>`‑n` | | NO | A logical `OR` to place before a signle domain (_arity 1_). Run `clo explain logic` for more details. | |
| `‑‑offset` | `POSITION` | NO | Number of results to ignore. | `0` |
| `‑‑limit` | `AMOUNT` | NO | Maximum number of records to return. | |
| `‑‑order` | `FIELD` | NO | The field to sort the records by. | |
| `‑‑raw`<br>`‑r` | | NO | Format output as space-separated IDs rather than pretty JSON. | `false` |
| `‑‑help`<br>`‑h` | | NO | Show this help message and exit. | |
#### Count
```sh
clo [OPTIONS] ACTION ... count [--domain FIELD OPERATOR VALUE] [--or] [--and] [--not] [--limit AMOUNT] [--help]
```
Returns the number of records in the current model matching the provided domain.
##### Options
| Flag(s) | Argument | Required | Description . | Default |
| :--- | :--: | :--: | :--- | :--- |
| `‑‑domain`<br>`‑d` | `FIELD`<br>`OPERATOR`<br>`VALUE` | NO | A set of criterion to filter the search by (_run `clo explain domains` for details_). This option can be specified multiple times. | `[]` |
| `‑‑or`<br>`‑o` | | NO | A logical `OR`, placed before two or more domains (_arity 2_). Run `clo explain logic` for more details. | |
| `‑‑and`<br>`‑a` | | NO | A logical `AND` to place before two or more domains (_arity 2_). Run `clo explain logic` for more details. | |
| `‑‑not`<br>`‑n` | | NO | A logical `OR` to place before a signle domain (_arity 1_). Run `clo explain logic` for more details. | |
| `‑‑limit` | `AMOUNT` | NO | Maximum number of records to return. | |
| `‑‑help`<br>`‑h` | | NO | Show this help message and exit. | |
#### Read
```sh
clo [OPTIONS] ACTION ... read --ids ID [ID ...] [--fields FIELD [FIELD ...]] [--csv] [--help]
```
Retrieves the details for the records at the ID(s) specified.
##### Options
| Flag(s) | Argument | Required | Description . | Default |
| :--- | :--: | :--: | :--- | :--- |
| `‑‑ids`<br>`‑i` | `ID` | YES | The ID number(_s_) of the record(_s_) to perform the action on. Specifying `-` expects a space-separated list from STDIN. | |
| `‑‑fields`<br>`‑f` | `FIELD` | NO | Field names to return (_default is all fields_). | `[]` |
| `‑‑csv` | | NO | If `True`, outputs records in CSV format. | `false` |
| `‑‑help`<br>`‑h` | | NO | Show this help message and exit. | |
#### Find
```sh
clo [OPTIONS] ACTION ... find [[-o|-n|-a] -d FIELD OPERATOR VALUE [-d ...]] [-f FIELD ...] [--offset POSITION] [--limit AMOUNT] [--order FIELD] [--csv [FILE]] [--help]
```
A shortcut that combines `search` and `read` into one execution.
##### Options
| Flag(s) | Argument | Required | Description . | Default |
| :--- | :--: | :--: | :--- | :--- |
| `‑‑domain`<br>`‑d` | `FIELD`<br>`OPERATOR`<br>`VALUE` | NO | A set of criterion to filter the search by (_run `clo explain domains` for details_). This option can be specified multiple times. | `[]` |
| `‑‑or`<br>`‑o` | | NO | A logical `OR`, placed before two or more domains (_arity 2_). Run `clo explain logic` for more details. | |
| `‑‑and`<br>`‑a` | | NO | A logical `AND` to place before two or more domains (_arity 2_). Run `clo explain logic` for more details. | |
| `‑‑not`<br>`‑n` | | NO | A logical `OR` to place before a signle domain (_arity 1_). Run `clo explain logic` for more details. | |
| `‑‑fields`<br>`‑f` | `FIELD` | NO | Field names to return (_default is all fields_). | `[]` |
| `‑‑offset` | `POSITION` | NO | Number of results to ignore. | `0` |
| `‑‑limit` | `AMOUNT` | NO | Maximum number of records to return. | |
| `‑‑order` | `FIELD` | NO | The field to sort the records by. | |
| `‑‑csv` | | NO | If `True`, outputs records in CSV format. | `false` |
| `‑‑help`<br>`‑h` | | NO | Show this help message and exit. | |
#### Create
```sh
clo [OPTIONS] ACTION ... create --value FIELD VALUE [--help]
```
Creates new records in the current model.
##### Options
| Flag(s) | Argument | Required | Description . | Default |
| :--- | :--: | :--: | :--- | :--- |
| `‑‑value`<br>`‑v` | `FIELD`<br>`VALUE` | YES | Key/value pair(_s_) that correspond to the field and assigment to be made, respectively. | |
| `‑‑help`<br>`‑h` | | NO | Show this help message and exit. | |
#### Write
```sh
clo [OPTIONS] ACTION ... write --ids ID [ID ...] --value FIELD VALUE [--help]
```
Updates existing records in the current model.
##### Options
| Flag(s) | Argument | Required | Description . | Default |
| :--- | :--: | :--: | :--- | :--- |
| `‑‑ids`<br>`‑i` | `ID` | YES | The ID number(_s_) of the record(_s_) to perform the action on. Specifying `-` expects a space-separated list from STDIN. | |
| `‑‑value`<br>`‑v` | `FIELD`<br>`VALUE` | YES | Key/value pair(_s_) that correspond to the field and assigment to be made, respectively. | |
| `‑‑help`<br>`‑h` | | NO | Show this help message and exit. | |
#### Delete
```sh
clo [OPTIONS] ACTION ... delete --ids ID [ID ...] [--help]
```
Deletes the records from the current model.
##### Options
| Flag(s) | Argument | Required | Description . | Default |
| :--- | :--: | :--: | :--- | :--- |
| `‑‑ids`<br>`‑i` | `ID` | YES | The ID number(_s_) of the record(_s_) to perform the action on. Specifying `-` expects a space-separated list from STDIN. | |
| `‑‑help`<br>`‑h` | | NO | Show this help message and exit. | |
#### Fields
```sh
clo [OPTIONS] ACTION ... fields [--attributes NAME [NAME ...]] [--help]
```
Retrieves raw details of the fields available in the current model.
For user-friendly formatting, run `clo [OPTIONS] ACTION ... fields explain fields`.
##### Options
| Flag(s) | Argument | Required | Description . | Default |
| :--- | :--: | :--: | :--- | :--- |
| `‑‑attributes`<br>`‑‑attr`<br>`‑a` | `NAME` | NO | Attribute(_s_) to return for each field, all if empty or not provided. | |
| `‑‑help`<br>`‑h` | | NO | Show this help message and exit. | |
#### Explain
```sh
clo [OPTIONS] ACTION ... explain [--verbose] [--help] {models,domains,logic,fields}
```
Display documentation on a specified topic.
##### Positional
| Argument | Required | Description . | Default |
| :--- | :--: | :--- | :--- |
| `{models,domains,logic,fields}` | YES | A topic to get further explanation on. | |
##### Options
| Flag(s) | Argument | Required | Description . | Default |
| :--- | :--: | :--: | :--- | :--- |
| `‑‑verbose`<br>`‑v` | | NO | Display more details. | `false` |
| `‑‑help`<br>`‑h` | | NO | Show this help message and exit. | |
### Concepts
The following breakdowns apply to search-style `ACTIONS`.
#### DOMAINS
A domain is a set of criteria, each criterion being a throuple of `(FIELD, OPERATOR, VALUE)` where:
`FIELD`: A field name of the current model, or a relationship traversal through a `Many2one`
using dot-notation.
`OPERATOR`: An operand used to compare the `FIELD` with the value. Valid operators are:
=, !=, >, >=, <, <= Standard comparison operators.
=? Unset or equals to (_returns true if value is either None or
False, otherwise behaves like `=`_).
=[i]like Matches `FIELD` against the value pattern. An underscore (_`_`_)
in the pattern matches any single character; a percent sign
(_`%`_) matches any string of zero or more characters. `=ilike`
makes the search case-insensitive.
[not ][i]like Matches (_or inverse-matches_) `FIELD` against the %value%
pattern. Similar to `=[i]like` but wraps value with `%` before
matching.
[not ]in Is—or is not—equal to any of the items from value, value should
be a list of items.
child_of Is a child (_descendant[2m_) of a value record (_[2mvalue can
be either one item or a list of items_). Takes the semantics
of the model into account (_i.e following the relationship
`FIELD` named by `VALUE`_).
parent_of Is a child (_ascendant[2m_) of a value record (_[2mvalue can
be either one item or a list of items_). Takes the semantics
of the model into account (_i.e following the relationship
`FIELD` named by `VALUE`_).
`VALUE`: Variable type, must be comparable (_through `OPERATOR`_) to the named `FIELD`.
#### LOGIC
Domain criteria can be combined using logical operators in prefix form:
--or -d login = user -d name = "John Smith" -d email = user@domain.com
is equivalent to `login == "user" || name == "John Smith" || email == "user@domain.com"`
--not -d login = user` or `-d login '!=' user
are equivalent to `login != "user"`. `--not` is generally unneeded, save for negating the OPERATOR, `child_of`, or `parent_of`.
--and -d login = user -d name = "John Smith"
is equivalent to `login == "user" && name == "John Smith"`; though, successive domainsimply `--and`.
## See Also
* [Changelog](https://github.com/LeShaunJ/clo/blob/main/CHANGELOG.md)
* [Contributing](https://github.com/LeShaunJ/clo/blob/main/CONTRIBUTING.md)
* [Code of Conduct](https://github.com/LeShaunJ/clo/blob/main/CODE_OF_CONDUCT.md)
* [Security](https://github.com/LeShaunJ/clo/blob/main/SECURITY.md)
![Banner][banner]
[banner]: https://leshaunj.github.io/clo/assets/images/logo-social.png
[build_status_badge]: https://github.com/LeShaunJ/clo/actions/workflows/test.yml/badge.svg
[build_status_link]: https://github.com/LeShaunJ/clo/actions/workflows/test.yml
[coverage_badge]: https://raw.githubusercontent.com/LeShaunJ/clo/main/docs/assets/images/coverage.svg
[coverage_link]: https://raw.githubusercontent.com/LeShaunJ/clo/main/docs/assets/images/coverage.svg
[pypi_badge]: https://badge.fury.io/py/clo.svg
[pypi_link]: https://badge.fury.io/py/clo
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this
project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.6.0] - 2023-10-21
**Fixed**
- Issue where non-API-required options prompt user for requisites/credentials.
**Changed**
- Env-vars now prefixed with `CLO_` instead of `OD_`.
- Auth env-vars no longer abbreviated.
- `--env` now defaults to `.clorc`, instead of `~/.clorc`.
- `--demo` now accepts the save path, as opposed to using `--out`.
- `--demo` now defaults to `.clorc`.
## [0.5.0] - 2023-10-16
**Added**
- Initial feature set.
- Added tests
Raw data
{
"_id": null,
"home_page": "https://leshaunj.github.io/clo",
"name": "clo",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": "",
"keywords": "cli python3 odoo command-line-tool api xmlrpc",
"author": "Arian Johnson",
"author_email": "i.am@ajohn.dev",
"download_url": "https://files.pythonhosted.org/packages/82/cc/4123a24ee000b3332e2bfa1a027d2dcc097cee4d8e4810732e17e6dade05/clo-0.6.0.tar.gz",
"platform": null,
"description": "# 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\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0. | Default |\n| :--- | :--: | :--: | :--- | :--- |\n| `\u2011\u2011model`<br>`\u2011m` | `MODEL` | NO | The Odoo model to perform an action on. Run `clo explain models [-v]` to list available options. | `\"res.users\"` |\n| `\u2011\u2011env` | `FILE` | NO | Path to a `.clorc` file. See [Requisites](#requisites) below for details. | `\".clorc\"` |\n| `\u2011\u2011inst`<br>`\u2011\u2011instance` | `URL` | NO | The address of the Odoo instance. See [Requisites](#requisites) below for details. | |\n| `\u2011\u2011db`<br>`\u2011\u2011database` | `NAME` | NO | The application database to perform operations on. See [Requisites](#requisites) below for details. | |\n| `\u2011\u2011user` | `NAME` | NO | The user to perform operations as. See [Requisites](#requisites) below for details. | |\n| `\u2011\u2011demo` | `FILE` | NO | Generate a demo instance from Odoo Cloud and save the connection properties to `FILE`. | `\".clorc\"` |\n| `\u2011\u2011out` | `FILE` | NO | Where to stream the output. | |\n| `\u2011\u2011log` | `LEVEL` | NO | The level (_`OFF`, `FATAL`, `ERROR`, `WARN`, `INFO`, `DEBUG`, `TRACE`_) of logs to produce. | `\"WARN\"` |\n| `\u2011\u2011dry\u2011run` | | NO | Perform a \"practice\" run of the action; implies `--log=DEBUG`. | `false` |\n| `\u2011\u2011help`<br>`\u2011h` | | NO | Show this help message and exit. | |\n| `\u2011\u2011version` | | NO | Show version of this program. | |\n\n> #### Requisites\n> \n> \n> The following inputs are **required**, but have multiple or special specifications. In the absense of these inputs, the program will ask for input:\n> \n> - `--instance` can be specified using environment variable **`CLO_INSTANCE`**.\n> - `--database` can be specified using environment variable **`CLO_DATABASE`**.\n> - `--username` can be specified using environment variable **`CLO_USERNAME`**.\n> - The `password` (_or `API-key`_) **MUST BE** specified using environment variable **`CLO_PASSWORD`**.\n> \n> `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\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0. | Default |\n| :--- | :--: | :--: | :--- | :--- |\n| `\u2011\u2011domain`<br>`\u2011d` | `FIELD`<br>`OPERATOR`<br>`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| `\u2011\u2011or`<br>`\u2011o` | | NO | A logical `OR`, placed before two or more domains (_arity 2_). Run `clo explain logic` for more details. | |\n| `\u2011\u2011and`<br>`\u2011a` | | NO | A logical `AND` to place before two or more domains (_arity 2_). Run `clo explain logic` for more details. | |\n| `\u2011\u2011not`<br>`\u2011n` | | NO | A logical `OR` to place before a signle domain (_arity 1_). Run `clo explain logic` for more details. | |\n| `\u2011\u2011offset` | `POSITION` | NO | Number of results to ignore. | `0` |\n| `\u2011\u2011limit` | `AMOUNT` | NO | Maximum number of records to return. | |\n| `\u2011\u2011order` | `FIELD` | NO | The field to sort the records by. | |\n| `\u2011\u2011raw`<br>`\u2011r` | | NO | Format output as space-separated IDs rather than pretty JSON. | `false` |\n| `\u2011\u2011help`<br>`\u2011h` | | 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\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0. | Default |\n| :--- | :--: | :--: | :--- | :--- |\n| `\u2011\u2011domain`<br>`\u2011d` | `FIELD`<br>`OPERATOR`<br>`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| `\u2011\u2011or`<br>`\u2011o` | | NO | A logical `OR`, placed before two or more domains (_arity 2_). Run `clo explain logic` for more details. | |\n| `\u2011\u2011and`<br>`\u2011a` | | NO | A logical `AND` to place before two or more domains (_arity 2_). Run `clo explain logic` for more details. | |\n| `\u2011\u2011not`<br>`\u2011n` | | NO | A logical `OR` to place before a signle domain (_arity 1_). Run `clo explain logic` for more details. | |\n| `\u2011\u2011limit` | `AMOUNT` | NO | Maximum number of records to return. | |\n| `\u2011\u2011help`<br>`\u2011h` | | 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\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0. | Default |\n| :--- | :--: | :--: | :--- | :--- |\n| `\u2011\u2011ids`<br>`\u2011i` | `ID` | YES | The ID number(_s_) of the record(_s_) to perform the action on. Specifying `-` expects a space-separated list from STDIN. | |\n| `\u2011\u2011fields`<br>`\u2011f` | `FIELD` | NO | Field names to return (_default is all fields_). | `[]` |\n| `\u2011\u2011csv` | | NO | If `True`, outputs records in CSV format. | `false` |\n| `\u2011\u2011help`<br>`\u2011h` | | 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\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0. | Default |\n| :--- | :--: | :--: | :--- | :--- |\n| `\u2011\u2011domain`<br>`\u2011d` | `FIELD`<br>`OPERATOR`<br>`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| `\u2011\u2011or`<br>`\u2011o` | | NO | A logical `OR`, placed before two or more domains (_arity 2_). Run `clo explain logic` for more details. | |\n| `\u2011\u2011and`<br>`\u2011a` | | NO | A logical `AND` to place before two or more domains (_arity 2_). Run `clo explain logic` for more details. | |\n| `\u2011\u2011not`<br>`\u2011n` | | NO | A logical `OR` to place before a signle domain (_arity 1_). Run `clo explain logic` for more details. | |\n| `\u2011\u2011fields`<br>`\u2011f` | `FIELD` | NO | Field names to return (_default is all fields_). | `[]` |\n| `\u2011\u2011offset` | `POSITION` | NO | Number of results to ignore. | `0` |\n| `\u2011\u2011limit` | `AMOUNT` | NO | Maximum number of records to return. | |\n| `\u2011\u2011order` | `FIELD` | NO | The field to sort the records by. | |\n| `\u2011\u2011csv` | | NO | If `True`, outputs records in CSV format. | `false` |\n| `\u2011\u2011help`<br>`\u2011h` | | 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\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0. | Default |\n| :--- | :--: | :--: | :--- | :--- |\n| `\u2011\u2011value`<br>`\u2011v` | `FIELD`<br>`VALUE` | YES | Key/value pair(_s_) that correspond to the field and assigment to be made, respectively. | |\n| `\u2011\u2011help`<br>`\u2011h` | | 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\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0. | Default |\n| :--- | :--: | :--: | :--- | :--- |\n| `\u2011\u2011ids`<br>`\u2011i` | `ID` | YES | The ID number(_s_) of the record(_s_) to perform the action on. Specifying `-` expects a space-separated list from STDIN. | |\n| `\u2011\u2011value`<br>`\u2011v` | `FIELD`<br>`VALUE` | YES | Key/value pair(_s_) that correspond to the field and assigment to be made, respectively. | |\n| `\u2011\u2011help`<br>`\u2011h` | | 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\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0. | Default |\n| :--- | :--: | :--: | :--- | :--- |\n| `\u2011\u2011ids`<br>`\u2011i` | `ID` | YES | The ID number(_s_) of the record(_s_) to perform the action on. Specifying `-` expects a space-separated list from STDIN. | |\n| `\u2011\u2011help`<br>`\u2011h` | | 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\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0. | Default |\n| :--- | :--: | :--: | :--- | :--- |\n| `\u2011\u2011attributes`<br>`\u2011\u2011attr`<br>`\u2011a` | `NAME` | NO | Attribute(_s_) to return for each field, all if empty or not provided. | |\n| `\u2011\u2011help`<br>`\u2011h` | | 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\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0. | 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\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0. | Default |\n| :--- | :--: | :--: | :--- | :--- |\n| `\u2011\u2011verbose`<br>`\u2011v` | | NO | Display more details. | `false` |\n| `\u2011\u2011help`<br>`\u2011h` | | 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 =, !=, >, >=, <, <= 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\u2014or is not\u2014equal 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\" && 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\n# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this\nproject adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n## [0.6.0] - 2023-10-21\n\n**Fixed**\n\n- Issue where non-API-required options prompt user for requisites/credentials.\n\n**Changed**\n\n- Env-vars now prefixed with `CLO_` instead of `OD_`.\n- Auth env-vars no longer abbreviated.\n- `--env` now defaults to `.clorc`, instead of `~/.clorc`.\n- `--demo` now accepts the save path, as opposed to using `--out`.\n- `--demo` now defaults to `.clorc`.\n\n## [0.5.0] - 2023-10-16\n\n**Added**\n\n- Initial feature set.\n- Added tests\n",
"bugtrack_url": null,
"license": "GPLv3",
"summary": "CLO (Command-Line Odoo) - Perform API operations on Odoo instances from the command-line.",
"version": "0.6.0",
"project_urls": {
"Homepage": "https://leshaunj.github.io/clo"
},
"split_keywords": [
"cli",
"python3",
"odoo",
"command-line-tool",
"api",
"xmlrpc"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "15746006be2ced0784f1aca13d2e2f41b7e596fc0eb17bb48f09f93826d3d57e",
"md5": "76ab2779bce21697ba73025b090b2b85",
"sha256": "9c343a2095c4794d10be73b31c6910561b591cd5756051ea569b6d45a5e0d75e"
},
"downloads": -1,
"filename": "clo-0.6.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "76ab2779bce21697ba73025b090b2b85",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 41022,
"upload_time": "2023-10-21T19:24:12",
"upload_time_iso_8601": "2023-10-21T19:24:12.344420Z",
"url": "https://files.pythonhosted.org/packages/15/74/6006be2ced0784f1aca13d2e2f41b7e596fc0eb17bb48f09f93826d3d57e/clo-0.6.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "82cc4123a24ee000b3332e2bfa1a027d2dcc097cee4d8e4810732e17e6dade05",
"md5": "d051383d34ec1dbdffbf181136a8f97f",
"sha256": "6c2e4d5b58ba8e96b0970fc7bf749495f12b4012ba7edd11e5cdbba966b551fa"
},
"downloads": -1,
"filename": "clo-0.6.0.tar.gz",
"has_sig": false,
"md5_digest": "d051383d34ec1dbdffbf181136a8f97f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 135586,
"upload_time": "2023-10-21T19:24:13",
"upload_time_iso_8601": "2023-10-21T19:24:13.974964Z",
"url": "https://files.pythonhosted.org/packages/82/cc/4123a24ee000b3332e2bfa1a027d2dcc097cee4d8e4810732e17e6dade05/clo-0.6.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-21 19:24:13",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "clo"
}