Skip to Content
Menu
This question has been flagged
1 Reply
2199 Views

Hello Forum - We are trying to create a Odoo Full stack deployments with Docker-compose and Github actions on a VPS . We are stuck in automating module installs as we are adding many modules in the addons folder and are able to auto install only a few modules via the -i cli parm. This is getting complex when some modules are not getting installed. This scenario is while we create a new stack. We also need to auto install in future without taking down PG or by restarting. Is it due to their dependencies or anything that we are missing? If it is the dependencies then it might be a tedious job  for 1 to figure out what modules use what. Please help us find an appropriate solution.

Avatar
Discard
Best Answer

Hi S V,

Try using the json_rpc method to install the modules using its inbuild functions.

import json
import random
import urllib.request

import erppeek


TEST_SERVER = 'http://localhost:8069'
ADMIN_PASSWORD = 'odoo'


def json_rpc(url, method, params):
data = {
"jsonrpc": "2.0",
"method": method,
"params": params,
"id": random.randint(0, 1000000000),
}
req = urllib.request.Request(url=url, data=json.dumps(data).encode(), headers={
"Content-Type": "application/json",
})
reply = json.loads(urllib.request.urlopen(req).read().decode('UTF-8'))
if reply.get("error"):
raise Exception(reply["error"])
return reply["result"]


def call(url, service, method, *args):
return json_rpc(url, "call", {"service": service, "method": method, "args": args})
 
test_client = erppeek.Client(server=TEST_SERVER)

_logger.info("Creating database: %s" % database_name)
test_client.create_database(ADMIN_PASSWORD, database_name)


db_client = erppeek.Client(TEST_SERVER, database_name, 'admin', 'admin')
installed_modules = db_client.modules(installed=True)

for module in main_module_list: #main_module_list is the list containing the modules to be installed
if module not in installed_modules:
_logger.info("Installing module: %s" % module)
db_client.install(module)

Regards

Avatar
Discard
Related Posts Replies Views Activity
5
Oct 24
597
1
Aug 24
392
1
May 24
1332
0
Aug 23
863
3
Apr 23
22063