Documentation
¶
Overview ¶
Package odoo contains client code of library
Index ¶
- Constants
- type Bool
- type Client
- func (c *Client) Close()
- func (c *Client) Count(model string, criteria *Criteria, options *Options) (int64, error)
- func (c *Client) Create(model string, values interface{}) (int64, error)
- func (c *Client) CreateIrModel(im *IrModel) (int64, error)
- func (c *Client) CreateIrModelFields(imf *IrModelFields) (int64, error)
- func (c *Client) Delete(model string, ids []int64) error
- func (c *Client) DeleteIrModel(id int64) error
- func (c *Client) DeleteIrModelFields(id int64) error
- func (c *Client) DeleteIrModelFieldss(ids []int64) error
- func (c *Client) DeleteIrModels(ids []int64) error
- func (c *Client) ExecuteKw(method, model string, args []interface{}, options *Options) (interface{}, error)
- func (c *Client) FieldsGet(model string, options *Options) (map[string]interface{}, error)
- func (c *Client) FindIrModelFieldss(criteria *Criteria, options *Options) (*IrModelFieldss, error)
- func (c *Client) FindIrModels(criteria *Criteria, options *Options) (*IrModels, error)
- func (c *Client) GetIrModel(id int64) (*IrModel, error)
- func (c *Client) GetIrModelFields(id int64) (*IrModelFields, error)
- func (c *Client) GetIrModelFieldss(ids []int64) (*IrModelFieldss, error)
- func (c *Client) GetIrModels(ids []int64) (*IrModels, error)
- func (c *Client) Read(model string, ids []int64, options *Options, elem interface{}) error
- func (c *Client) Search(model string, criteria *Criteria, options *Options) ([]int64, error)
- func (c *Client) SearchRead(model string, criteria *Criteria, options *Options, elem interface{}) error
- func (c *Client) Update(model string, ids []int64, values interface{}) error
- func (c *Client) UpdateIrModel(im *IrModel) error
- func (c *Client) UpdateIrModelFields(imf *IrModelFields) error
- func (c *Client) UpdateIrModelFieldss(ids []int64, imf *IrModelFields) error
- func (c *Client) UpdateIrModels(ids []int64, im *IrModel) error
- func (c *Client) Version() (Version, error)
- type ClientConfig
- type Criteria
- type Float
- type Int
- type IrModel
- type IrModelFields
- type IrModelFieldss
- type IrModels
- type Many2One
- type Options
- func (o *Options) Add(opt string, v interface{}) *Options
- func (o *Options) AllFields(fields ...string) *Options
- func (o *Options) Attributes(attributes ...string) *Options
- func (o *Options) FetchFields(fields ...string) *Options
- func (o *Options) Limit(limit int) *Options
- func (o *Options) Offset(offset int) *Options
- type Relation
- func (r *Relation) AddNewRecord(values interface{})
- func (r *Relation) AddRecord(record int)
- func (r *Relation) DeleteRecord(record int64)
- func (r *Relation) Get() []int64
- func (r *Relation) RemoveAllRecords()
- func (r *Relation) RemoveRecord(record int64)
- func (r *Relation) ReplaceAllRecords(newRecords []int64)
- func (r *Relation) UpdateRecord(record int64, values interface{})
- type Selection
- type String
- type Time
- type Version
Constants ¶
const IrModelFieldsModel = "ir.model.fields"
IrModelFieldsModel is the odoo model name
const IrModelModel = "ir.model"
IrModelModel is the odoo model name
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides high and low level functions to interact with odoo
func NewClient ¶
func NewClient(cfg *ClientConfig) (*Client, error)
NewClient creates a new *Client.
func (*Client) Count ¶
Count model records matching with *Criteria. https://www.odoo.com/documentation/13.0/webservices/odoo.html#count-records
func (*Client) Create ¶
Create a new model. https://www.odoo.com/documentation/13.0/webservices/odoo.html#create-records
func (*Client) CreateIrModel ¶
CreateIrModel creates a new ir.model model and returns its id.
func (*Client) CreateIrModelFields ¶
func (c *Client) CreateIrModelFields(imf *IrModelFields) (int64, error)
CreateIrModelFields creates a new ir.model.fields model and returns its id.
func (*Client) Delete ¶
Delete existing model row(s). https://www.odoo.com/documentation/13.0/webservices/odoo.html#delete-records
func (*Client) DeleteIrModel ¶
DeleteIrModel deletes an existing ir.model record.
func (*Client) DeleteIrModelFields ¶
DeleteIrModelFields deletes an existing ir.model.fields record.
func (*Client) DeleteIrModelFieldss ¶
DeleteIrModelFieldss deletes existing ir.model.fields records.
func (*Client) DeleteIrModels ¶
DeleteIrModels deletes existing ir.model records.
func (*Client) ExecuteKw ¶
func (c *Client) ExecuteKw(method, model string, args []interface{}, options *Options) (interface{}, error)
ExecuteKw is a RPC function. The lowest library function. It is use for all function related to "xmlrpc/2/object" endpoint.
func (*Client) FieldsGet ¶
FieldsGet inspect model fields. https://www.odoo.com/documentation/13.0/webservices/odoo.html#listing-record-fields
func (*Client) FindIrModelFieldss ¶
func (c *Client) FindIrModelFieldss(criteria *Criteria, options *Options) (*IrModelFieldss, error)
FindIrModelFieldss finds ir.model.fields records by querying it and filtering it with criteria and options.
func (*Client) FindIrModels ¶
FindIrModels finds ir.model records by querying it and filtering it with criteria and options.
func (*Client) GetIrModel ¶
GetIrModel gets ir.model existing record.
func (*Client) GetIrModelFields ¶
func (c *Client) GetIrModelFields(id int64) (*IrModelFields, error)
GetIrModelFields gets ir.model.fields existing record.
func (*Client) GetIrModelFieldss ¶
func (c *Client) GetIrModelFieldss(ids []int64) (*IrModelFieldss, error)
GetIrModelFieldss gets ir.model.fields existing records.
func (*Client) GetIrModels ¶
GetIrModels gets ir.model existing records.
func (*Client) Read ¶
Read model records matching with ids. https://www.odoo.com/documentation/13.0/webservices/odoo.html#read-records
func (*Client) Search ¶
Search model record ids matching with *Criteria. https://www.odoo.com/documentation/13.0/webservices/odoo.html#list-records
func (*Client) SearchRead ¶
func (c *Client) SearchRead(model string, criteria *Criteria, options *Options, elem interface{}) error
SearchRead search model records matching with *Criteria and read it. https://www.odoo.com/documentation/13.0/webservices/odoo.html#search-and-read
func (*Client) Update ¶
Update existing model row(s). https://www.odoo.com/documentation/13.0/webservices/odoo.html#update-records
func (*Client) UpdateIrModel ¶
UpdateIrModel pdates an existing ir.model record.
func (*Client) UpdateIrModelFields ¶
func (c *Client) UpdateIrModelFields(imf *IrModelFields) error
UpdateIrModelFields pdates an existing ir.model.fields record.
func (*Client) UpdateIrModelFieldss ¶
func (c *Client) UpdateIrModelFieldss(ids []int64, imf *IrModelFields) error
UpdateIrModelFieldss updates existing ir.model.fields records. All records (represented by ids) will be updated by imf values.
func (*Client) UpdateIrModels ¶
UpdateIrModels updates existing ir.model records. All records (represented by ids) will be updated by im values.
type ClientConfig ¶
ClientConfig is the configuration to create a new *Client by givin connection infomations.
type Criteria ¶
type Criteria []*criterion
Criteria is a set of criterion, each criterion is a triple (field_name, operator, value). It allow you to search models. see documentation: https://www.odoo.com/documentation/13.0/reference/orm.html#reference-orm-domains
type Float ¶
type Float struct {
// contains filtered or unexported fields
}
Float is a float64 wrapper
type IrModel ¶
type IrModel struct {
LastUpdate *Time `xmlrpc:"__last_update,omptempty"`
AccessIds *Relation `xmlrpc:"access_ids,omptempty"`
Count *Int `xmlrpc:"count,omptempty"`
CreateDate *Time `xmlrpc:"create_date,omptempty"`
CreateUid *Many2One `xmlrpc:"create_uid,omptempty"`
DisplayName *String `xmlrpc:"display_name,omptempty"`
FieldId *Relation `xmlrpc:"field_id,omptempty"`
Id *Int `xmlrpc:"id,omptempty"`
Info *String `xmlrpc:"info,omptempty"`
InheritedModelIds *Relation `xmlrpc:"inherited_model_ids,omptempty"`
Model *String `xmlrpc:"model,omptempty"`
Modules *String `xmlrpc:"modules,omptempty"`
Name *String `xmlrpc:"name,omptempty"`
RuleIds *Relation `xmlrpc:"rule_ids,omptempty"`
State *Selection `xmlrpc:"state,omptempty"`
Transient *Bool `xmlrpc:"transient,omptempty"`
ViewIds *Relation `xmlrpc:"view_ids,omptempty"`
WriteDate *Time `xmlrpc:"write_date,omptempty"`
WriteUid *Many2One `xmlrpc:"write_uid,omptempty"`
}
IrModel represents ir.model model
type IrModelFields ¶
type IrModelFields struct {
LastUpdate *Time `xmlrpc:"__last_update,omptempty"`
Column1 *String `xmlrpc:"column1,omptempty"`
Column2 *String `xmlrpc:"column2,omptempty"`
CompleteName *String `xmlrpc:"complete_name,omptempty"`
Compute *String `xmlrpc:"compute,omptempty"`
Copied *Bool `xmlrpc:"copied,omptempty"`
CreateDate *Time `xmlrpc:"create_date,omptempty"`
CreateUid *Many2One `xmlrpc:"create_uid,omptempty"`
Depends *String `xmlrpc:"depends,omptempty"`
DisplayName *String `xmlrpc:"display_name,omptempty"`
Domain *String `xmlrpc:"domain,omptempty"`
FieldDescription *String `xmlrpc:"field_description,omptempty"`
Groups *Relation `xmlrpc:"groups,omptempty"`
Help *String `xmlrpc:"help,omptempty"`
Id *Int `xmlrpc:"id,omptempty"`
Index *Bool `xmlrpc:"index,omptempty"`
Model *String `xmlrpc:"model,omptempty"`
ModelId *Many2One `xmlrpc:"model_id,omptempty"`
Modules *String `xmlrpc:"modules,omptempty"`
Name *String `xmlrpc:"name,omptempty"`
OnDelete *Selection `xmlrpc:"on_delete,omptempty"`
Readonly *Bool `xmlrpc:"readonly,omptempty"`
Related *String `xmlrpc:"related,omptempty"`
RelatedFieldId *Many2One `xmlrpc:"related_field_id,omptempty"`
Relation *String `xmlrpc:"relation,omptempty"`
RelationField *String `xmlrpc:"relation_field,omptempty"`
RelationFieldId *Many2One `xmlrpc:"relation_field_id,omptempty"`
RelationTable *String `xmlrpc:"relation_table,omptempty"`
Required *Bool `xmlrpc:"required,omptempty"`
Selectable *Bool `xmlrpc:"selectable,omptempty"`
Selection *String `xmlrpc:"selection,omptempty"`
SelectionIds *Relation `xmlrpc:"selection_ids,omptempty"`
Size *Int `xmlrpc:"size,omptempty"`
State *Selection `xmlrpc:"state,omptempty"`
Store *Bool `xmlrpc:"store,omptempty"`
Translate *Bool `xmlrpc:"translate,omptempty"`
Ttype *Selection `xmlrpc:"ttype,omptempty"`
WriteDate *Time `xmlrpc:"write_date,omptempty"`
WriteUid *Many2One `xmlrpc:"write_uid,omptempty"`
}
IrModelFields represents ir.model.fields model
type IrModelFieldss ¶
type IrModelFieldss []IrModelFields
IrModelFieldss represents array of ir.model.fields model
type Many2One ¶
Many2One represents odoo many2one type. https://www.odoo.com/documentation/13.0/reference/orm.html#relational-fields
func NewMany2One ¶
NewMany2One create a new *Many2One.
type Options ¶
type Options map[string]interface{}
Options allow you to filter search results.
func (*Options) AllFields ¶
AllFields is useful for FieldsGet function. It represents the fields to document you want odoo to return. https://www.odoo.com/documentation/13.0/reference/orm.html#fields-views
func (*Options) Attributes ¶
Attributes is useful for FieldsGet function. It represents the attributes to document you want odoo to return. https://www.odoo.com/documentation/13.0/reference/orm.html#fields-views
func (*Options) FetchFields ¶
FetchFields allow you to precise the model fields you want odoo to return. https://www.odoo.com/documentation/13.0/webservices/odoo.html#search-and-read
func (*Options) Limit ¶
Limit adds the limit options. https://www.odoo.com/documentation/13.0/webservices/odoo.html#pagination
type Relation ¶
type Relation struct {
// contains filtered or unexported fields
}
Relation represents odoo one2many and many2many types. https://www.odoo.com/documentation/13.0/reference/orm.html#relational-fields
func (*Relation) AddNewRecord ¶
func (r *Relation) AddNewRecord(values interface{})
AddNewRecord is an helper to create a new record of one2many or many2many. https://www.odoo.com/documentation/13.0/reference/orm.html#odoo.models.Model.write
func (*Relation) AddRecord ¶
AddRecord is an helper to add an existing record of one2many or many2many. https://www.odoo.com/documentation/13.0/reference/orm.html#odoo.models.Model.write
func (*Relation) DeleteRecord ¶
DeleteRecord is an helper to delete an existing record of one2many or many2many. https://www.odoo.com/documentation/13.0/reference/orm.html#odoo.models.Model.write
func (*Relation) RemoveAllRecords ¶
func (r *Relation) RemoveAllRecords()
RemoveAllRecords is an helper to remove all records of one2many or many2many. https://www.odoo.com/documentation/13.0/reference/orm.html#odoo.models.Model.write
func (*Relation) RemoveRecord ¶
RemoveRecord is an helper to remove an existing record of one2many or many2many. https://www.odoo.com/documentation/13.0/reference/orm.html#odoo.models.Model.write
func (*Relation) ReplaceAllRecords ¶
ReplaceAllRecords is an helper to replace all records of one2many or many2many. https://www.odoo.com/documentation/13.0/reference/orm.html#odoo.models.Model.write
func (*Relation) UpdateRecord ¶
UpdateRecord is an helper to update an existing record of one2many or many2many. https://www.odoo.com/documentation/13.0/reference/orm.html#odoo.models.Model.write
type Selection ¶
type Selection struct {
// contains filtered or unexported fields
}
Selection represents selection odoo type.
func NewSelection ¶
func NewSelection(v interface{}) *Selection
NewSelection creates a new *Selection.
type String ¶
type String struct {
// contains filtered or unexported fields
}
String is a string wrapper