跳至内容
菜单
此问题已终结
2 回复
6430 查看

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

The database contains only the modules chosen by the customer.

形象
丢弃
最佳答案

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

形象
丢弃

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!

编写者 最佳答案

Hi Yenthe

 Thank you so much

形象
丢弃

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

编写者

can you give me your email to contact you,please