Skip to main content

odoo@1.0.3

create(model, data, options)
deleteRecord(model, recordId)
read(model, recordId, fields)
update(model, recordId, data)

Functions

create

create(model, data, options) ⇒ Operation

Create a record in Odoo. You can pass an external ID to the options object to create a record with a specific ID. You can also pass a downloadNewRecord option to download the whole created resource in the response.

ParamTypeDescription
modelstringThe specific record model i.e. "res.partner"
dataobjectThe data to be created in JSON.
optionsCreateOptionsOptions to send to the request.

This operation writes the following keys to state:

State KeyDescription
dataThe response body (as JSON)
responseThe HTTP response from the Odoo server (excluding the body)
referencesAn array of all previous data objects used in the Job

Example: Create a partner record with an external Id

create('res.partner', { name: 'Kool Keith' }, { externalId: 23 });

Example: Create a partner record and download the whole record in the response

create('res.partner', { name: 'Kool Keith' }, { downloadNewRecord: true });

deleteRecord

deleteRecord(model, recordId) ⇒ Operation

Delete a record from Odoo

ParamTypeDescription
modelstringThe specific record model i.e. "res.partner"
recordIdnumberThe specific recordId to be deleted.

This operation writes the following keys to state:

State KeyDescription
dataThe response body (as JSON)
responseThe HTTP response from the Odoo server (excluding the body)
referencesAn array of all previous data objects used in the Job

Example

deleteRecord("res.partner", 54 );

read

read(model, recordId, fields) ⇒ Operation

Get a record from Odoo. Returns all fields unless a field list is provided as a third argument

ParamTypeDescription
modelstringThe specific record model from i.e. "res.partner"
recordIdnumberAn array of record IDs to read.
fieldsArray.<string>An optional array of field strings to read from the record.

This operation writes the following keys to state:

State KeyDescription
dataThe response body (as JSON)
responseThe HTTP response from the Odoo server (excluding the body)
referencesAn array of all previous data objects used in the Job

Example: Download records with select fields

read("res.partner", [1] , ['name']);

Example: Download a single record with all fields

read("res.partner", $.recordIds);

update

update(model, recordId, data) ⇒ Operation

Update a record in Odoo

ParamTypeDescription
modelstringThe specific record model i.e. "res.partner"
recordIdnumberThe specific recordId to be updated.
dataobjectThe data to be updated in JSON.

This operation writes the following keys to state:

State KeyDescription
dataThe response body (as JSON)
responseThe HTTP response from the Odoo server (excluding the body)
referencesAn array of all previous data objects used in the Job

Example

update("res.partner", 54 , {name: 'Jane Doe'});

Interfaces

CreateOptions

Options object

Properties

NameTypeDescription
externalIdnumberAn optional id to be used in the request
downloadNewRecordbooleanAn option defaulted to false incase a user intends to receive the whole created resource in the response. The collective response will be written in state.data.

OdooState

State object

Properties

NameDescription
dataThe response body (as JSON)
responseThe HTTP response from the Odoo server (excluding the body)
referencesAn array of all previous data objects used in the Job