This question has been flagged
1 Reply
23210 Views

Hello,

I successfully installed Odoo on Ubuntu with command line:

odoo-bin -d mydatabase -i base --stop-after-init

All is working fine, but with the default user & password is admin:admin.

I want to know is there any parameter to set user login and password in command line?

for example like:

odoo-bin -d mydatabase -i base -user otheruser --password otherpassword




Avatar
Discard
Best Answer

Hello ipoy

I try odoo with docker, and I success to change username and password in odoo:13.0 with an ansible task using odoo shell, that open a python prompt:

- name: Change admin user
  become: true
  expect:
    command: docker run --name odoo_shell --rm --network pg_network -e HOST=postgres -e USER=*** -e PASSWORD=*** -it odoo:13.0 odoo shell -d mydatabase
    responses:
      '>>> ':
        - user = env['res.users'].search([('login', '=', 'admin')])
        - user.name = 'foobar'
        - user.login = 'foo'
        - user.password = 'bar'
        - self.env.cr.commit()
        - quit()

Maybe something like this could resolve your problem with ansible:

- name: Change admin user
  become: true
  expect:
    command: odoo-bin shell -d mydatabase
    responses:
      '>>> ':
        - user = env['res.users'].search([('login', '=', 'admin')])
        - user.name = 'foobar'
        - user.login = 'foo'
        - user.password = 'bar'
        - self.env.cr.commit()
        - quit()

Without ansible, you can use linux expect command: https://linux.die.net/man/1/expect, https://www.thegeekstuff.com/2010/10/expect-examples/

An other link about odoo shell: https://www.youtube.com/watch?v=k434qcOt7nY

Avatar
Discard