Skip to Content
Odoo Menu
  • Zaloguj się
  • Wypróbuj za darmo
  • Aplikacje
    Finanse
    • Księgowość
    • Fakturowanie
    • Wydatki
    • Arkusz kalkulacyjny (BI)
    • Dokumenty
    • Podpisy
    Sprzedaż
    • CRM
    • Sprzedaż
    • PoS Sklep
    • PoS Restauracja
    • Subskrypcje
    • Wypożyczalnia
    Strony Internetowe
    • Kreator Stron Internetowych
    • eCommerce
    • Blog
    • Forum
    • Czat na Żywo
    • eLearning
    Łańcuch dostaw
    • Magazyn
    • Produkcja
    • PLM
    • Zakupy
    • Konserwacja
    • Jakość
    Zasoby Ludzkie
    • Pracownicy
    • Rekrutacja
    • Urlopy
    • Ocena pracy
    • Polecenia Pracownicze
    • Flota
    Marketing
    • Marketing Społecznościowy
    • E-mail Marketing
    • SMS Marketing
    • Wydarzenia
    • Automatyzacja Marketingu
    • Ankiety
    Usługi
    • Projekt
    • Ewidencja czasu pracy
    • Usługi Terenowe
    • Helpdesk
    • Planowanie
    • Spotkania
    Produktywność
    • Dyskusje
    • Zatwierdzenia
    • IoT
    • VoIP
    • Baza wiedzy
    • WhatsApp
    Aplikacje trzecich stron Studio Odoo Odoo Cloud Platform
  • Branże
    Sprzedaż detaliczna
    • Księgarnia
    • Sklep odzieżowy
    • Sklep meblowy
    • Sklep spożywczy
    • Sklep z narzędziami
    • Sklep z zabawkami
    Żywienie i hotelarstwo
    • Bar i Pub
    • Restauracja
    • Fast Food
    • Pensjonat
    • Dystrybutor napojów
    • Hotel
    Agencja nieruchomości
    • Agencja nieruchomości
    • Biuro architektoniczne
    • Budowa
    • Zarządzanie nieruchomościami
    • Ogrodnictwo
    • Stowarzyszenie właścicieli nieruchomości
    Doradztwo
    • Biuro księgowe
    • Partner Odoo
    • Agencja marketingowa
    • Kancelaria prawna
    • Agencja rekrutacyjna
    • Audyt i certyfikacja
    Produkcja
    • Tekstylia
    • Metal
    • Meble
    • Jedzenie
    • Browar
    • Prezenty firmowe
    Zdrowie & Fitness
    • Klub sportowy
    • Salon optyczny
    • Centrum fitness
    • Praktycy Wellness
    • Apteka
    • Salon fryzjerski
    Transakcje
    • Złota rączka
    • Wsparcie Sprzętu IT
    • Systemy energii słonecznej
    • Szewc
    • Firma sprzątająca
    • Usługi HVAC
    Inne
    • Organizacja non-profit
    • Agencja Środowiskowa
    • Wynajem billboardów
    • Fotografia
    • Leasing rowerów
    • Sprzedawca oprogramowania
    Przeglądaj wszystkie branże
  • Community
    Ucz się
    • Samouczki
    • Dokumentacja
    • Certyfikacje
    • Szkolenie
    • Blog
    • Podcast
    Pomóż w nauce innym
    • Program Edukacyjny
    • Scale Up! Gra biznesowa
    • Odwiedź Odoo
    Skorzystaj z oprogramowania
    • Pobierz
    • Porównaj edycje
    • Wydania
    Współpracuj
    • Github
    • Forum
    • Wydarzenia
    • Tłumaczenia
    • Zostań partnerem
    • Usługi dla partnerów
    • Zarejestruj swoją firmę rachunkową
    Skorzystaj z usług
    • Znajdź partnera
    • Znajdź księgowego
    • Spotkaj się z doradcą
    • Usługi wdrożenia
    • Opinie klientów
    • Wsparcie
    • Aktualizacje
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Zaplanuj demo
  • Cennik
  • Pomoc

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Księgowość
  • Zapasy
  • PoS
  • Projekt
  • MRP
All apps
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Pomoc

How to script the creation of a new database?

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
databasecli
5 Odpowiedzi
26804 Widoki
Awatar
Ian Beardslee

We are trying to improve our development process and part of that is ensuring that people create a new database and install our modules in their dev environment as part of their test process before they commit their changes to our git repo.

Using ..

/usr/bin/openerp-server -c /etc/openerp/openerp-server.conf --init=our_module --stop-after-init -d test_database

.. I can script the installation of our modules in a new database that as been created through the web interface, but how can that new test_database be created from the command line?

We must update our modules to a duplicate of our existing database .. which leads to a 2nd related question .. is there a way to duplicate an existing database from the command line?

3
Awatar
Odrzuć
Awatar
Marwan Yassin
Najlepsza odpowiedź

For Odoo 9, and most likely with every Odoo version higher than 6.1
first:

pip install oerplib 

Then create a python script : create_db.py

#!/usr/bin/python

import sys #import sys if you want command line args

import oerplib

oerp = oerplib.OERP(server='localhost', protocol='xmlrpc', port=8069)

oerp.db.create_database('SUPER_ADMIN_PWD', "DB_NAME", False, 'en_US', "DB_PASS")

---------
You can replace DB_NAME and DB_PASS with sys.argv[n] and pass the value from command line or script

1
Awatar
Odrzuć
Awatar
rahim
Najlepsza odpowiedź

My question too

0
Awatar
Odrzuć
Awatar
Em Sciara
Najlepsza odpowiedź

On Odoo 9.0 (and I guess also 8.0), if test_database does not exist, the exact command you wrote will create it automatically through the -d flag...

0
Awatar
Odrzuć
Atte Isopuro

As far as I can tell this does not work in 8.0: Odoo will fail startup with an OperationalError.

Awatar
Laura Jarvenpaa
Najlepsza odpowiedź

stackoverflow.com/questions/876522/creating-a-copy-of-a-database-in-postgres (can't post links so removed the http part)

From there duplicating db from command line:

createdb -O ownername -T originaldb newdb

Haven't tested this one but would assume that it works because it has been voted as a good answer.

0
Awatar
Odrzuć
Ian Beardslee
Autor

Hmm that is a valid workaround. I was actually trying to work out how to do it via OpenERP. Ultimate goal is to have a single script that runs on the OpenERP server that drops some test databases, creates one 'empty' OpenERP database to install our module and a duplicate of an existing database and updates our modules. Running it via OpenERP (running 'openerp-server' as the 'openerp' user) gets around the idea of having to provide additional credentials to do something on the DB server.

Awatar
Royal Administrator
Najlepsza odpowiedź

# thanks to https://pythonhosted.org/OERPLib/

I have been able to create a database using oerplib from https://pythonhosted.org/OERPLib/, one of the two client libraries I have found "out there", the other being openerplib from https://pypi.python.org/pypi/openerp-client-lib.

Using oerplib:

# pip install oerplib

# python
>>> import oerplib
>>> jconn = oerplib.rpc.ConnectorJSONRPC('localhost', port=8069)
>>> jconn.proxy.web.database.get_list()
>>> jconn.proxy.web.database.create(fields=[{'name': 'super_admin_pwd', 'value': 'master-secret'}, {'name': 'db_name', 'value': 'my-new-database'}, {'name': 'create_admin_pwd', 'value': 'secret'}, {'name': 'create_confirm_pwd', 'value': 'secret'}, {'name': 'db_lang', 'value': 'en_US'}])

There are more concise mechanisms also, without all the 'name', 'value', etc.
This mechanism as written has indeed create a database for me.

God speed on your database creation automation journey,

0
Awatar
Odrzuć
Podoba Ci się ta dyskusja? Dołącz do niej!

Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!

Zarejestruj się
Powiązane posty Odpowiedzi Widoki Czynność
Database disappeared from list after activating Google Oauth for administrator
database
Awatar
0
lip 25
2291
Setup Odoo with specific database
database
Awatar
Awatar
2
lis 24
8513
database locked
database
Awatar
Awatar
Awatar
2
paź 24
4857
my data base is locked
database
Awatar
Awatar
2
sie 24
2692
How do i provide one database to one client if i have multiple databases in one server? Rozwiązane
database
Awatar
Awatar
Awatar
Awatar
3
lip 24
9239
Społeczność
  • Samouczki
  • Dokumentacja
  • Forum
Open Source
  • Pobierz
  • Github
  • Runbot
  • Tłumaczenia
Usługi
  • Hosting Odoo.sh
  • Wsparcie
  • Aktualizacja
  • Indywidualne rozwiązania
  • Edukacja
  • Znajdź księgowego
  • Znajdź partnera
  • Zostań partnerem
O nas
  • Nasza firma
  • Zasoby marki
  • Skontaktuj się z nami
  • Oferty pracy
  • Wydarzenia
  • Podcast
  • Blog
  • Klienci
  • Informacje prawne • Prywatność
  • Bezpieczeństwo Odoo
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo to pakiet aplikacji biznesowych typu open source, które zaspokoją wszystkie potrzeby Twojej firmy: CRM, eCommerce, księgowość, inwentaryzacja, punkt sprzedaży, zarządzanie projektami itp.

Unikalną wartością Odoo jest to, że jest jednocześnie bardzo łatwe w użyciu i w pełni zintegrowane.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now