Package: clo
CLO (Command-Line Odoo)Perform API operations on Odoo instances via the command-line.ContentsInstallationUsageGlobalsOptionsRequisitesActionsSearchCountReadFindCreateWriteDeleteFieldsExplainConceptsSee AlsoInstallationpip3installcloUsageclo[OPTIONS]ACTION...GlobalsThe following parameters apply to anyAction.OptionsFlag(s)ArgumentRequiredDescription                                                                         .Default‑‑model‑mMODELNOThe Odoo model to perform an action on. Runclo explain models [-v]to list                             available options."res.users"‑‑envFILENOPath to a.clorcfile. SeeRequisitesbelow for details.".clorc"‑‑inst‑‑instanceURLNOThe address of the Odoo instance. SeeRequisitesbelow for details.‑‑db‑‑databaseNAMENOThe application database to perform operations on. SeeRequisitesbelow                             for details.‑‑userNAMENOThe user to perform operations as. SeeRequisitesbelow for details.‑‑demoFILENOGenerate a demo instance from Odoo Cloud and save the connection properties toFILE.".clorc"‑‑outFILENOWhere to stream the output.‑‑logLEVELNOThe level (OFF,FATAL,ERROR,WARN,INFO,DEBUG,TRACE) of logs to produce."WARN"‑‑dry‑runNOPerform a "practice" run of the action; implies--log=DEBUG.false‑‑help‑hNOShow this help message and exit.‑‑versionNOShow version of this program.RequisitesThe following inputs arerequired, but have multiple or special specifications. In the absense of these inputs, the program will ask for input:--instancecan be specified using environment variableCLO_INSTANCE.--databasecan be specified using environment variableCLO_DATABASE.--usernamecan be specified using environment variableCLO_USERNAME.Thepassword(orAPI-key)MUST BEspecified using environment variableCLO_PASSWORD.cloalso looks for a.clorcfile in the working directory that contain these values, or the file specified by--env FILE, if it exists.ActionsThe Odoo instance is queried, or operated on, usingACTIONS. EachACTIONhas it's own set of arguements; runclo ACTION --helpfor specific details.Searchclo[OPTIONS]ACTION...search[[-o|-n|-a]-dFIELDOPERATORVALUE[-d...]][--offsetPOSITION][--limitAMOUNT][--orderFIELD][--count][-h]Searches for record IDs based on the search domain.OptionsFlag(s)ArgumentRequiredDescription                                                                         .Default‑‑domain‑dFIELDOPERATORVALUENOA set of criterion to filter the search by (runclo explain domainsfor details). This option can be specified multiple times.[]‑‑or‑oNOA logicalOR, placed before two or more domains (arity 2). Runclo explain logicfor more details.‑‑and‑aNOA logicalANDto place before two or more domains (arity 2). Runclo explain logicfor more details.‑‑not‑nNOA logicalORto place before a signle domain (arity 1). Runclo explain logicfor more details.‑‑offsetPOSITIONNONumber of results to ignore.0‑‑limitAMOUNTNOMaximum number of records to return.‑‑orderFIELDNOThe field to sort the records by.‑‑raw‑rNOFormat output as space-separated IDs rather than pretty JSON.false‑‑help‑hNOShow this help message and exit.Countclo[OPTIONS]ACTION...count[--domainFIELDOPERATORVALUE][--or][--and][--not][--limitAMOUNT][--help]Returns the number of records in the current model matching the provided domain.OptionsFlag(s)ArgumentRequiredDescription                                                                         .Default‑‑domain‑dFIELDOPERATORVALUENOA set of criterion to filter the search by (runclo explain domainsfor details). This option can be specified multiple times.[]‑‑or‑oNOA logicalOR, placed before two or more domains (arity 2). Runclo explain logicfor more details.‑‑and‑aNOA logicalANDto place before two or more domains (arity 2). Runclo explain logicfor more details.‑‑not‑nNOA logicalORto place before a signle domain (arity 1). Runclo explain logicfor more details.‑‑limitAMOUNTNOMaximum number of records to return.‑‑help‑hNOShow this help message and exit.Readclo[OPTIONS]ACTION...read--idsID[ID...][--fieldsFIELD[FIELD...]][--csv][--help]Retrieves the details for the records at the ID(s) specified.OptionsFlag(s)ArgumentRequiredDescription                                                                         .Default‑‑ids‑iIDYESThe ID number(s) of the record(s) to perform the action on. Specifying-expects a space-separated list from STDIN.‑‑fields‑fFIELDNOField names to return (default is all fields).[]‑‑csvNOIfTrue, outputs records in CSV format.false‑‑help‑hNOShow this help message and exit.Findclo[OPTIONS]ACTION...find[[-o|-n|-a]-dFIELDOPERATORVALUE[-d...]][-fFIELD...][--offsetPOSITION][--limitAMOUNT][--orderFIELD][--csv[FILE]][--help]A shortcut that combinessearchandreadinto one execution.OptionsFlag(s)ArgumentRequiredDescription                                                                         .Default‑‑domain‑dFIELDOPERATORVALUENOA set of criterion to filter the search by (runclo explain domainsfor details). This option can be specified multiple times.[]‑‑or‑oNOA logicalOR, placed before two or more domains (arity 2). Runclo explain logicfor more details.‑‑and‑aNOA logicalANDto place before two or more domains (arity 2). Runclo explain logicfor more details.‑‑not‑nNOA logicalORto place before a signle domain (arity 1). Runclo explain logicfor more details.‑‑fields‑fFIELDNOField names to return (default is all fields).[]‑‑offsetPOSITIONNONumber of results to ignore.0‑‑limitAMOUNTNOMaximum number of records to return.‑‑orderFIELDNOThe field to sort the records by.‑‑csvNOIfTrue, outputs records in CSV format.false‑‑help‑hNOShow this help message and exit.Createclo[OPTIONS]ACTION...create--valueFIELDVALUE[--help]Creates new records in the current model.OptionsFlag(s)ArgumentRequiredDescription                                                                         .Default‑‑value‑vFIELDVALUEYESKey/value pair(s) that correspond to the field and assigment to be made, respectively.‑‑help‑hNOShow this help message and exit.Writeclo[OPTIONS]ACTION...write--idsID[ID...]--valueFIELDVALUE[--help]Updates existing records in the current model.OptionsFlag(s)ArgumentRequiredDescription                                                                         .Default‑‑ids‑iIDYESThe ID number(s) of the record(s) to perform the action on. Specifying-expects a space-separated list from STDIN.‑‑value‑vFIELDVALUEYESKey/value pair(s) that correspond to the field and assigment to be made, respectively.‑‑help‑hNOShow this help message and exit.Deleteclo[OPTIONS]ACTION...delete--idsID[ID...][--help]Deletes the records from the current model.OptionsFlag(s)ArgumentRequiredDescription                                                                         .Default‑‑ids‑iIDYESThe ID number(s) of the record(s) to perform the action on. Specifying-expects a space-separated list from STDIN.‑‑help‑hNOShow this help message and exit.Fieldsclo[OPTIONS]ACTION...fields[--attributesNAME[NAME...]][--help]Retrieves raw details of the fields available in the current model.
For user-friendly formatting, runclo [OPTIONS] ACTION ... fields explain fields.OptionsFlag(s)ArgumentRequiredDescription                                                                         .Default‑‑attributes‑‑attr‑aNAMENOAttribute(s) to return for each field, all if empty or not provided.‑‑help‑hNOShow this help message and exit.Explainclo[OPTIONS]ACTION...explain[--verbose][--help]{models,domains,logic,fields}Display documentation on a specified topic.PositionalArgumentRequiredDescription                                                                         .Default{models,domains,logic,fields}YESA topic to get further explanation on.OptionsFlag(s)ArgumentRequiredDescription                                                                         .Default‑‑verbose‑vNODisplay more details.false‑‑help‑hNOShow this help message and exit.ConceptsThe following breakdowns apply to search-styleACTIONS.DOMAINSA 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 aMany2oneusing dot-notation.OPERATOR:   An operand used to compare theFIELDwith 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 (throughOPERATOR) to the namedFIELD.LOGICDomain criteria can be combined using logical operators in prefix form:--or -d login = user -d name = "John Smith" -d email = user@domain.comis equivalent tologin == "user" || name == "John Smith" || email == "user@domain.com"--not -d login = user` or `-d login '!=' userare equivalent tologin != "user".--notis generally unneeded, save for negating the OPERATOR,child_of, orparent_of.--and -d login = user -d name = "John Smith"is equivalent tologin == "user" && name == "John Smith"; though, successive domainsimply--and.See AlsoChangelogContributingCode of ConductSecurityChangelogAll notable changes to this project will be documented in this file.The format is based onKeep a Changelog, and this
project adheres toSemantic Versioning.[0.6.0] - 2023-10-21FixedIssue where non-API-required options prompt user for requisites/credentials.ChangedEnv-vars now prefixed withCLO_instead ofOD_.Auth env-vars no longer abbreviated.--envnow defaults to.clorc, instead of~/.clorc.--demonow accepts the save path, as opposed to using--out.--demonow defaults to.clorc.[0.5.0] - 2023-10-16AddedInitial feature set.Added tests