skilld-labs / go-odoo

Golang wrapper for Odoo API
Apache License 2.0
86 stars 62 forks source link

Is it possible to change the password of an odoo user with the library? #42

Closed jsebasmuller closed 1 year ago

jsebasmuller commented 1 year ago

Hello friends, I have a small query and it is possible to make an endpoint with the library to make it possible to change the password of an odoo web user? Thank you very much for your answers.

ahuret commented 1 year ago

Hello @jsebasmuller , yes you can using res_users model. Here is an example:

package main

import (
    "log"

    odoo "github.com/skilld-labs/go-odoo"
)

func main() {
    c, err := odoo.NewClient(&odoo.ClientConfig{
        Admin:    "admin",
        Password: "password",
        Database: "odoo",
        URL:      "http://localhost:8069",
    })
    if err != nil {
        log.Fatal(err)
    }
    u := &odoo.ResUsers{
                Id: odoo.NewInt(190),
        Password: odoo.NewString("somepassword"),
    }
    if err := c.UpdateResUsers(u); err != nil {
            log.Fatal(err)
        }
}
jsebasmuller commented 1 year ago

Thank u @ahuret