odoo

package
v0.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StringToCommand

func StringToCommand(cmd *Command, str string) error

Types

type Command

type Command struct {
	Description   string
	Model         string
	Domain        [][]interface{}
	Limit         int
	Offset        int
	Fields        []string
	IDS           []int
	AllFields     OdooFieldsResult
	FieldsUpdated bool
	Order         string
	Page          int
	Pages         int
	Count         int
	Context       OdooContext
}

func NewCommand

func NewCommand(odooCfg *OdooConfig, model string, domain [][]interface{}, fields []string, limit int, order string, context OdooContext) *Command

func NewCommandIDs added in v0.2.0

func NewCommandIDs(model string, ids []int) *Command

func (*Command) AreFieldsUpdated added in v0.2.0

func (cmd *Command) AreFieldsUpdated() bool

func (*Command) GoToFirstPage

func (cmd *Command) GoToFirstPage(rotate bool) bool

func (*Command) GoToLastPage

func (cmd *Command) GoToLastPage(rotate bool) bool

func (*Command) GoToNextPage

func (cmd *Command) GoToNextPage(rotate bool) bool

func (*Command) GoToPage

func (cmd *Command) GoToPage(page int, rotate bool) bool

func (*Command) GoToPreviousPage

func (cmd *Command) GoToPreviousPage(rotate bool) bool

func (*Command) SetFieldsUpdated added in v0.2.0

func (cmd *Command) SetFieldsUpdated()

func (*Command) SetID

func (cmd *Command) SetID(id int)

func (*Command) UpdateCommandFields

func (cmd *Command) UpdateCommandFields(server *Server, odooCfg *OdooConfig) error

func (*Command) UseAllFields added in v0.2.0

func (cmd *Command) UseAllFields()

type OdooConfig

type OdooConfig struct {
	Log          *logrus.Logger
	DefaultLimit int
	Timeout      int
	Mutex        sync.RWMutex
	NoAutoId     bool
}

type OdooContext

type OdooContext map[string]interface{}

type OdooError

type OdooError struct {
	Code    int              `json:"code"`
	Message string           `json:"message"`
	Data    OdooResponseData `json:"data"`
}

type OdooFieldInfo

type OdooFieldInfo struct {
	Description      string        `mapstructure:"string"`
	Type             string        `mapstructure:"type"`
	Relation         string        `mapstructure:"relation"`
	RelationField    string        `mapstructure:"relation_field"`
	Manual           bool          `mapstructure:"manual"`
	Required         bool          `mapstructure:"required"`
	Readonly         bool          `mapstructure:"readonly"`
	Selection        []interface{} `mapstructure:"selection"`
	Store            bool          `mapstructure:"store"`
	CompanyDependent bool          `mapstructure:"company_dependent"`
	Searchable       bool          `mapstructure:"searchable"`
	Sortable         bool          `mapstructure:"sortable"`
}

type OdooFieldsResult

type OdooFieldsResult map[string]OdooFieldInfo

type OdooFieldsViewGetResult

type OdooFieldsViewGetResult struct {
	Arch      string `mapstructure:"arch"`
	BaseModel string `mapstructure:"base_model"`
	Model     string `mapstructure:"model"`
	Name      string `mapstructure:"name"`
	Type      string `mapstructure:"type"`
	ViewID    int    `mapstructure:"view_id"`
}

type OdooMetadataItem added in v0.2.0

type OdooMetadataItem struct {
	ID         int           `mapstructure:"id"`
	XMLID      interface{}   `mapstructure:"xmlid"`
	NoUpdate   interface{}   `mapstructure:"noupdate"`
	CreateUID  []interface{} `mapstructure:"create_uid"`
	CreateDate interface{}   `mapstructure:"create_date"`
	WriteUID   []interface{} `mapstructure:"write_uid"`
	WriteDate  interface{}   `mapstructure:"write_date"`
}

type OdooMetadataResult added in v0.2.0

type OdooMetadataResult []OdooMetadataItem

type OdooNameGetResult

type OdooNameGetResult [][]interface{}

type OdooReadResult

type OdooReadResult []map[string]interface{}

type OdooResponse

type OdooResponse struct {
	JsonRPC string      `json:"jsonrpc"`
	ID      int         `json:"id"`
	Error   OdooError   `json:"error"`
	Result  interface{} `json:"result"`
	Cookies map[string]string
}

type OdooResponseData

type OdooResponseData struct {
	Name      string        `json:"name"`
	Message   string        `json:"message"`
	Debug     string        `json:"debug"`
	Arguments []interface{} `json:"arguments"`
	Context   OdooContext   `json:"context"`
}

type OdooSearchResult

type OdooSearchResult []int

type OdooTree

type OdooTree struct {
	XMLName xml.Name `xml:"tree"`
	Text    string   `xml:",chardata"`
	String  string   `xml:"string,attr"`
	Field   []struct {
		Text      string `xml:",chardata"`
		Name      string `xml:"name,attr"`
		String    string `xml:"string,attr"`
		OnChange  string `xml:"on_change,attr"`
		Modifiers string `xml:"modifiers,attr"`
		Invisible string `xml:"invisible,attr"`
		Class     string `xml:"class,attr"`
		Optional  string `xml:"optional,attr"`
		Widget    string `xml:"widget,attr"`
		Domain    string `xml:"domain,attr"`
		CanCreate string `xml:"can_create,attr"`
		CanWrite  string `xml:"can_write,attr"`
		Readonly  string `xml:"readonly,attr"`
		Options   string `xml:"options,attr"`
	} `xml:"field"`
}

type OdooUserResult

type OdooUserResult struct {
	UID           int         `mapstructure:"uid"`
	IsAdmin       bool        `mapstructure:"is_admin"`
	UserContext   OdooContext `mapstructure:"user_context"`
	ServerVersion string      `mapstructure:"server_version"`
}

type RelatedCommand

type RelatedCommand struct {
	Model       string
	Field       string
	IDs         []int
	Score       int
	Description string
	Context     OdooContext
	OriginField string
	Type        string
}

func GetRelatedCommand added in v0.2.0

func GetRelatedCommand(model string, rcmds []RelatedCommand) (rcmd RelatedCommand, err error)

func GetRelatedCommands

func GetRelatedCommands(odoocfg *OdooConfig, lastCommand *Command) ([]RelatedCommand, error)

func NewRelatedCommand

func NewRelatedCommand(odooCfg *OdooConfig, model string, field string, ids []int, description string, ttype string, context OdooContext) *RelatedCommand

func (*RelatedCommand) GetCommand

func (rcmd *RelatedCommand) GetCommand(odooCfg *OdooConfig) *Command

func (*RelatedCommand) SetIDs

func (rcmd *RelatedCommand) SetIDs(ids []int)

type Server

type Server struct {
	Host, Database, User, HiddenPassword, Password string
	UID                                            int
	Readonly                                       bool
}

func NewServer added in v0.2.0

func NewServer(host, database, user, password string) *Server

func (*Server) Authenticate

func (server *Server) Authenticate(odooCfg *OdooConfig) (OdooResponse, error)

func (*Server) CallDB added in v0.2.0

func (server *Server) CallDB(odooCfg *OdooConfig, method string) (OdooResponse, error)

func (*Server) CallObject

func (server *Server) CallObject(odooCfg *OdooConfig, object string, method string, args ...interface{}) (OdooResponse, error)

func (*Server) Count

func (server *Server) Count(cmd *Command, odooCfg *OdooConfig) (int, error)

func (*Server) Fields

func (server *Server) Fields(cmd *Command, odooCfg *OdooConfig) (OdooFieldsResult, error)

func (*Server) FieldsTree

func (server *Server) FieldsTree(cmd *Command, odooCfg *OdooConfig) ([]string, error)

func (*Server) FieldsViewGet

func (server *Server) FieldsViewGet(cmd *Command, odooCfg *OdooConfig) ([]string, error)

func (Server) GetName

func (server Server) GetName() string

func (*Server) GetServerVersion added in v0.2.0

func (server *Server) GetServerVersion(odooCfg *OdooConfig) (string, error)

func (*Server) ListDatabases added in v0.2.0

func (server *Server) ListDatabases(odooCfg *OdooConfig) ([]string, error)

func (*Server) Metadata added in v0.2.0

func (server *Server) Metadata(cmd *Command, odooCfg *OdooConfig) (OdooMetadataResult, error)

func (*Server) NameGet

func (server *Server) NameGet(cmd *Command, odooCfg *OdooConfig) (OdooNameGetResult, error)

func (*Server) Read

func (server *Server) Read(cmd *Command, ids []int, odooCfg *OdooConfig) (OdooReadResult, error)

func (*Server) ReadOneFieldX2Many

func (server *Server) ReadOneFieldX2Many(fieldName string, relation string, x2ManyData X2ManyResult, fieldIDs []int, odooCfg *OdooConfig) error

func (*Server) ReadX2Many

func (server *Server) ReadX2Many(cmd *Command, data OdooReadResult, odooCfg *OdooConfig) (X2ManyResult, error)

func (*Server) Search

func (server *Server) Search(cmd *Command, odooCfg *OdooConfig) (OdooSearchResult, error)

func (*Server) SearchRead

func (server *Server) SearchRead(cmd *Command, odooCfg *OdooConfig) (OdooReadResult, error)

type X2ManyResult

type X2ManyResult map[string]map[int]string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL