{"id":25010013,"url":"https://github.com/helvethink/go-odoo","last_synced_at":"2026-02-02T15:21:52.675Z","repository":{"id":275008283,"uuid":"924749828","full_name":"Helvethink/go-odoo","owner":"Helvethink","description":"Golang wrapper for Odoo API","archived":false,"fork":false,"pushed_at":"2025-03-27T23:46:10.000Z","size":592,"stargazers_count":2,"open_issues_count":5,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-28T00:26:50.536Z","etag":null,"topics":["api-wrapper","golang","odoo","odoo-18"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Helvethink.png","metadata":{"files":{"readme":"README.md","changelog":"change_password_own.go","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-30T15:35:21.000Z","updated_at":"2025-03-27T23:41:17.000Z","dependencies_parsed_at":"2025-03-28T00:35:58.743Z","dependency_job_id":null,"html_url":"https://github.com/Helvethink/go-odoo","commit_stats":null,"previous_names":["helvethink/go-odoo"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Helvethink%2Fgo-odoo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Helvethink%2Fgo-odoo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Helvethink%2Fgo-odoo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Helvethink%2Fgo-odoo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Helvethink","download_url":"https://codeload.github.com/Helvethink/go-odoo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250494742,"owners_count":21440036,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-wrapper","golang","odoo","odoo-18"],"created_at":"2025-02-05T04:52:25.187Z","updated_at":"2026-02-02T15:21:52.644Z","avatar_url":"https://github.com/Helvethink.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-odoo\n\nAn Odoo API client enabling Go programs to interact with Odoo in a simple and uniform way.\n\n[![GitHub license](https://img.shields.io/github/license/helvethink/go-odoo.svg)](https://github.com/helvethink/go-odoo/blob/master/LICENSE)\n[![GoDoc](https://godoc.org/github.com/helvethink/go-odoo?status.svg)](https://pkg.go.dev/github.com/helvethink/go-odoo?tab=doc)\n[![Go Report Card](https://goreportcard.com/badge/github.com/helvethink/go-odoo)](https://goreportcard.com/report/github.com/helvethink/go-odoo)\n[![GitHub issues](https://img.shields.io/github/issues/helvethink/go-odoo.svg)](https://github.com/helvethink/go-odoo/issues)\n![OpenSSF Scorecard](https://img.shields.io/ossf-scorecard/github.com/Helvethink/go-odoo?label=openssf%20scorecard\u0026style=flat)\n[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/10107/badge)](https://www.bestpractices.dev/projects/10107)\n\n## Usage\n\n### Generate your models\n\nBuild your generator:\n```bash\ncd generator\ngo build -o generator\n```\n\n```bash\n./generator/generator -u admin_name -p admin_password -d database_name -o /the/directory/you/want/the/files/to/be/generated/in --url http://localhost:8069 -t ./generator/cmd/tmpl/model.tmpl -m crm.lead,res.users\n```\n\nIn order to find your Odoo instance model names, visit https://odoo-instance/web?debug=assets#action=19\u0026model=ir.model\u0026view_type=list\u0026cids=1\u0026menu_id=31\n\n\nThat's it ! Your models have been generated !\n\n### Current generated models\n\n#### Core models\n\nCore models are `ir_model.go` and `ir_model_fields.go` since there are used to generate models.\n\nIt is **highly recommanded** to not remove them, since you would not be able to generate models again.\n\n#### Custom skilld-labs models\n\nAll other models (not core one) are specific to skilld-labs usage. They use our own odoo instance which is **version 11**. (note that models structure changed between odoo major versions).\n\nIf you're ok to work with those models, you can use this library instance, if not you should fork the repository and generate you own models by following steps above.\n\n### Enjoy coding!\n\n(All exemples on this README are based on model `crm.lead`)\n\n```go\npackage main\n\nimport (\n\t\"github.com/Helvethink/go-odoo\"\n)\n\nfunc main() {\n\tc, err := odoo.NewClient(\u0026odoo.ClientConfig{\n\t\tAdmin:    \"admin_name\",\n\t\tPassword: \"admin_password\",\n\t\tDatabase: \"database_name\",\n\t\tURL:      \"http://localhost:8069\",\n\t})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tcrm := \u0026odoo.CrmLead{\n\t\tName: odoo.NewString(\"my first opportunity\"),\n\t}\n\tif id, err := c.CreateCrmLead(crm); err != nil {\n\t\tlog.Fatal(err)\n\t} else {\n\t\tfmt.Printf(\"the id of the new crm.lead is %d\", id)\n\t}\n}\n```\n\n## Models\n\nGenerated models contains high level functions to interact with models in an easy and golang way.\nIt covers the most common usage and contains for each model those functions :\n\n### Create\n```go\nfunc (c *Client) CreateCrmLead(cl *CrmLead) (int64, error) {}\nfunc (c *Client) CreateCrmLeads(cls []*CrmLead) ([]int64, error) {} // !! Only for odoo 12+ versions !!\n```\n\n### Update\n```go\nfunc (c *Client) UpdateCrmLead(cl *CrmLead) error {}\nfunc (c *Client) UpdateCrmLeads(ids []int64, cl *CrmLead) error {}\n```\n\n### Delete\n```go\nfunc (c *Client) DeleteCrmLead(id int64) error {}\nfunc (c *Client) DeleteCrmLeads(ids []int64) error {}\n```\n\n### Get\n```go\nfunc (c *Client) GetCrmLead(id int64) (*CrmLead, error) {}\nfunc (c *Client) GetCrmLeads(ids []int64) (*CrmLeads, error) {}\n```\n\n### Find\nFind is powerful and allow you to query a model and filter results. [Criteria and Options](#criteria-and-options)\n\n```go\nfunc (c *Client) FindCrmLead(criteria *Criteria) (*CrmLead, error) {}\nfunc (c *Client) FindCrmLeads(criteria *Criteria, options *Options) (*CrmLeads, error) {}\n```\n\n### Conversion\nGenerated models can be converted to `Many2One` easily.\n```go\nfunc (cl *CrmLead) Many2One() *Many2One {}\n```\n\n## Types\n\nThe library contains custom types to improve the usability :\n\n### Basic types\n\n```go\nfunc NewString(v string) *String {}\nfunc (s *String) Get() string {}\n\nfunc NewInt(v int64) *Int {}\nfunc (i *Int) Get() int64 {}\n\nfunc NewBool(v bool) *Bool {}\nfunc (b *Bool) Get() bool {}\n\nfunc NewSelection(v interface{}) *Selection {}\nfunc (s *Selection) Get() (interface{}) {}\n\nfunc NewTime(v time.Time) *Time {}\nfunc (t *Time) Get() time.Time {}\n\nfunc NewFloat(v float64) *Float {}\nfunc (f *Float) Get() float64 {}\n```\n\n### Relational types\n\n```go\nfunc NewMany2One(id int64, name string) *Many2One {}\nfunc NewUnassignedMany2One() *Many2One {}\nfunc (m *Many2One) Get() int64 {}\n\nfunc NewRelation() *Relation {}\nfunc (r *Relation) Get() []int64 {}\n```\none2many and many2many are represented by the `Relation` type and allow you to execute special actions as defined [here](https://www.odoo.com/documentation/13.0/reference/orm.html#odoo.models.Model.write).\n\n### Criteria and Options\n\n`Criteria` is a set of Criterion and allow you to query models. [More informations](https://www.odoo.com/documentation/13.0/reference/orm.html#search-domains)\n\n#### Combined Criterions\n\nCriterions can be combined using AND (arity 2), OR (arity 2) and NOT (arity 1) operators.\nCriteria have And, Or and Not methods to be able to do such query eg:\n\n```go\nc := odoo.NewCriteria().Or(\n\todoo.NewCriterion(\"user_id.name\", \"=\", \"Jane Doe\"),\n\todoo.NewCriterion(\"user_id.name\", \"=\", \"John Doe\"),\n)\n```\n\n`Options` allow you to filter results.\n\n```go\ncls, err := c.FindCrmLeads(odoo.NewCriteria().Add(\"user_id.name\", \"=\", \"John Doe\"), odoo.NewOptions().Limit(2))\n```\n\n## Low level functions\n\nAll high level functions are based on basic odoo webservices functions.\n\nThese functions give you more flexibility but less usability. We recommend you to use models functions (high level).\n\nHere are available low level functions :\n\n```go\nfunc (c *Client) Create(model string, values []interface{}, options *Options) ([]int64, error) {} !! Creating multiple instances is only for odoo 12+ versions !!\nfunc (c *Client) Update(model string, ids []int64, values interface{}, options *Options) error {}\nfunc (c *Client) Delete(model string, ids []int64) error {}\nfunc (c *Client) SearchRead(model string, criteria *Criteria, options *Options, elem interface{}) error {}\nfunc (c *Client) Read(model string, ids []int64, options *Options, elem interface{}) error {}\nfunc (c *Client) Count(model string, criteria *Criteria, options *Options) (int64, error) {}\nfunc (c *Client) Search(model string, criteria *Criteria, options *Options) ([]int64, error) {}\nfunc (c *Client) FieldsGet(model string, options *Options) (map[string]interface{}, error) {}\nfunc (c *Client) ExecuteKw(method, model string, args []interface{}, options *Options) (interface{}, error) {}\n```\n\n## Todo\n\n- Tests\n- Modular template\n\n## Issues\n\n- If you have an issue, please report it on the [issue tracker](https://github.com/helvethink/go-odoo/issues)\n\n## Special thanks\n\nAs we forked [Skilld-Labs project](https://github.com/skilld-labs/go-odoo) to [Helvethink Godoo Project](https://github.com/helvethink/go-odoo), I want to take a moment to express our sincere gratitude for the incredible work and dedication you've put into [Skilld-Labs project](https://github.com/skilld-labs/go-odoo). Your efforts laid the foundation upon which we’re building today.\n\nThank you for everything you've done, and please know that your efforts are deeply appreciated.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhelvethink%2Fgo-odoo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhelvethink%2Fgo-odoo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhelvethink%2Fgo-odoo/lists"}