Skip to content

Latest commit

 

History

History
66 lines (50 loc) · 1.29 KB

README.md

File metadata and controls

66 lines (50 loc) · 1.29 KB

godoo

Odoo API client for Go.

Install

go install github.com/llonchj/godoo@latest

Using the API

This is an example of how create a new sale order :

package main

//go:generate godoo add all --uri http://localhost:8069 --database test --username admin --password password


import (
 "fmt"

 "github.com/llonchj/godoo/api"
)

func main() {
 config := &api.Config{
  DbName:   "test",
  Admin:    "admin",
  Password: "password",
  URI:      "http://localhost:8069",
 }

 c, err := config.NewClient()
 if err != nil {
  fmt.Println(err.Error())
 }
 err = c.CompleteSession()
 if err != nil {
  fmt.Println(err.Error())
 }

 //get the sale order service
 s := api.NewSaleOrderService(c)
 //call the function GetAll() linked to the sale order service
 so, err := s.GetAll()
 if err != nil {
  fmt.Println(err.Error())
 }
 fmt.Println(so)
}

ToDo

docker compose run odoo odoo -i base -d odoo --stop-after-init