Skip to Content
Menu
This question has been flagged
2 Replies
5805 Views

how to create database for a client with code (not with interface) ?

The database contains only the modules chosen by the customer.

Avatar
Discard
Best Answer

Hi Sonia,

This is exactly what ERPpeek is made for (an external Python library). With ERPpeek you could do this in just a few lines of code. For example:

import erppeek DATABASE = 'ErpPeekDemoDatabase' SERVER = 'http://localhost:8080' ADMIN_PASSWORD = 'admin' client = erppeek.Client(server=SERVER) if not DATABASE in client.db.list(): print("The database does not exist yet, creating one!") client.create_database(ADMIN_PASSWORD, DATABASE) else: print("The database " + DATABASE + " already exists."

You can also install modules with ERPpeek:

client = erppeek.Client('http://localhost:8080', 'ErpPeekDemoDatabase', 'admin', 'admin') modules = client.modules('sale', installed=False) if 'sale' in modules['uninstalled']: client.install('sale')

Another way you could do this is by custom development through Python but ERPpeek works fine here and you could already use all the functions that are made, which are very powerful.
I've made some example scripts which you can find here: https://github.com/Yenthe666/Odoo_Samples/tree/master/ErpPeekDemo

Yenthe

Avatar
Discard

Hi yenthe, I am looking for something like that.
In a nutshell, generating instances of odoo for customers based on sub domain with some installed modules.

Is this still up-to-date/ best solution ?
Thanks

Hi Yenthe, is there any way to do it for Odoo 16 ? I would appreciate your help. Thank you!

Author Best Answer

Hi Yenthe

 Thank you so much

Avatar
Discard

No problem! If it helped you please upvote / accept the answer. :)

Author

can you give me your email to contact you,please