class Odoo (View source)

Properties

string $common Common client
string $object Object client
protected integer $uid Odoo User identifier
protected string $db DB Name
protected string $host Host Name
protected string $username DB Username
protected string $password DB Password
protected string $suffix API host suffix
protected string $commonEndPoint Common endpoint meta-calls which don't require authentication
protected string $objectEndPoint Object endpoint
protected array $condition Where Condition
protected integer $offset Offset
protected integer $limit Limit available to only retrieve a subset of all matched records
protected array $fields fields to be requested

Methods

__construct()

Create a new Odoo instance

$this
connect(string $db = null, string $username = null, string $password = null, array $array = [])

Login to Odoo ERP.

string|true
can(string $permission, string $model, bool $withExceptions = false)

Check access rights on a model.

$this
where(string $field, string $operator, string $value = null)

Set condition for search query

$this
limit(int $limit, int $offset)

Limit helps to only retrieve a subset of all matched records second parameter, offset to start from that value.

$this
fields(array $fields)

Set fields to retrieve.

Collection
search(string $model)

Get the ids of the models.

integer
count(string $model)

Count the items in a model's table.

Collection
get(string $model)

Get a list of records.

Collection|string
version(string $key = null)

Retrieve Odoo version.

Collection
fieldsOf(string $model)

Get a collection of fields of a model table.

integer
create(string $model, array $data)

Create a single record and return its database identifier.

true|string
update(string $model, array $data)

Update one or more records.

true|string
deleteById(string $model, array|Collection|int $id)

Remove a record by Id or Ids.

true|string
delete(string $model)

Remove one or a group of records.

Collection
call($params)

Run execute_kw call with provided params.

Ripcord_Client
getClient(string $endPoint)

Get a XML-RPC client

$this
host($url)

Set host

$this
username(string $username)

Set username

$this
password(string $password)

Set password.

$this
db(string $name)

Set db name.

$this
apiSuffix($name)

Set API suffix.

integer
getUid()

Get the Odoo user identifier

string
getHost()

Get host

string
getDb()

Get db

string
getUserName()

Get username

string
getPassword()

Get password

Details

__construct()

Create a new Odoo instance

$this connect(string $db = null, string $username = null, string $password = null, array $array = [])

Login to Odoo ERP.

Parameters

string $db
string $username
string $password
array $array

Return Value

$this

Exceptions

OdooException

string|true can(string $permission, string $model, bool $withExceptions = false)

Check access rights on a model.

return true or a string with the error.

Parameters

string $permission
string $model
bool $withExceptions

Return Value

string|true

$this where(string $field, string $operator, string $value = null)

Set condition for search query

Parameters

string $field
string $operator
string $value

Return Value

$this

$this limit(int $limit, int $offset)

Limit helps to only retrieve a subset of all matched records second parameter, offset to start from that value.

Parameters

int $limit
int $offset

Return Value

$this

$this fields(array $fields)

Set fields to retrieve.

Parameters

array $fields

Return Value

$this

Get the ids of the models.

Parameters

string $model

Return Value

Collection

Exceptions

OdooException

integer count(string $model)

Count the items in a model's table.

Parameters

string $model

Return Value

integer

Exceptions

OdooException

Collection get(string $model)

Get a list of records.

Parameters

string $model

Return Value

Collection

Exceptions

OdooException

Collection|string version(string $key = null)

Retrieve Odoo version.

If key passed it returns the key value of the collection No need authentication

Parameters

string $key

Return Value

Collection|string

Collection fieldsOf(string $model)

Get a collection of fields of a model table.

Parameters

string $model

Return Value

Collection

integer create(string $model, array $data)

Create a single record and return its database identifier.

Parameters

string $model
array $data

Return Value

integer

true|string update(string $model, array $data)

Update one or more records.

returns true except when an error happened.

Parameters

string $model
array $data

Return Value

true|string

Exceptions

OdooException

true|string deleteById(string $model, array|Collection|int $id)

Remove a record by Id or Ids.

returns true except when an error happened.

Parameters

string $model
array|Collection|int $id

Return Value

true|string

true|string delete(string $model)

Remove one or a group of records.

returns true except when an error happened.

Parameters

string $model

Return Value

true|string

Exceptions

OdooException

Collection call($params)

Run execute_kw call with provided params.

Parameters

$params

Return Value

Collection

Ripcord_Client getClient(string $endPoint)

Get a XML-RPC client

Parameters

string $endPoint

Return Value

Ripcord_Client

$this host($url)

Set host

Parameters

$url

Return Value

$this

$this username(string $username)

Set username

Parameters

string $username

Return Value

$this

$this password(string $password)

Set password.

Parameters

string $password

Return Value

$this

$this db(string $name)

Set db name.

Parameters

string $name

Return Value

$this

$this apiSuffix($name)

Set API suffix.

Parameters

$name

Return Value

$this

integer getUid()

Get the Odoo user identifier

Return Value

integer

string getHost()

Get host

Return Value

string

string getDb()

Get db

Return Value

string

string getUserName()

Get username

Return Value

string

string getPassword()

Get password

Return Value

string