Still can not install my module in Tryton

Trying to install my custom module into Tryton. No errors while setup and startup. And even my custom class is registered but no any traces of the new module in Tryton web-client.
The setup is two docker containers (within Ubuntu Server 18.04) with tryton and a postgres DB.
trytond-admin ver. 5.6.3
module called ‘fleets’.
I used cookiecutter to create module structure. I followed manual of module creation, and seems checked all cross-referrences between .py files and xml-s.

I did required install and all updates:

python3 setup.py develop (in the folder ../modules/fleets)
trytond-admin -u fleets  --activate-dependencies -c /etc/trytond.conf 
trytond-admin --update-modules-list --activate-dependencies -c /etc/trytond.conf

But still no module in Tryton.
I started Tryton server with DEBUG info and I can see that class is actually registered:
Mon Jul 20 01:41:18 2020] INFO:trytond.modules:fleets:registering classes
then I can see the Pool:

Mon Jul 20 01:42:31 2020] INFO:trytond.pool:init pool for "tryton"
... <no my module here> ....
Mon Jul 20 01:42:33 2020] INFO:trytond.modules:all modules loaded

And… no any mentions of my module anymore.
No success.
————
I spent hours, trying to understand where to look at. I have no idea how to debug this problem. I checked DB tables — there is no mention either fields of my module nor the module name (‘fleets’) itself.
What should be my next step?

Thanks,
Constantine.

1 Like

I would first ensure that the module is properly installed.

you could run a python interpreter and manually import the module:

$ path/to/venv/bin/python3
>>> import trytond.modules.fleets
>>> 

it should have no error.

Could be database name parameter is missing in trytond-admin command? Os is it defined in environment variable?

You have to create a symlink on …/modules/your_module_name in trytond/trytond/modules

See script: tryton-env: 1974cf50ce46 .hooks/link_modules

$ path/to/venv/bin/python3
>>> import trytond.modules.fleets

Thank you! Good idea to test the installation quickly.
Tested right now. No errors. Yet, as it is shown here: INFO:trytond.modules:fleets:registering classes — I did not expect any troubles here.

I set the address in the config:

[database]
uri = postgresql://postgres:<************>@postgres:5432/

So if you do not specify a database then trytond-admin will not know in which database to update the module list.

So if you do not specify a database then trytond-admin will not know in which database to update the module list.

I used string:
trytond-admin -u fleets --activate-dependencies -c /etc/trytond.conf

Why don’t? In this config it is explicitly set the uri

[database]
uri = postgresql://postgres:<************>@postgres:5432/

Also, I can not understand how I can point to URL instead of path in ‘-d’ parameter.

It is missing -d <database name>

1 Like

Sure, it is missing: that is not possible to connect to DB with -d parameter as PostgreSQL is in the other container and the only way to connect it by the following:

postgresql://postgres:<************>@postgres:5432/

Again, I have no local database in this Tryton container.
Based on the help by trytond-admin:
…The config file can be
specified in the TRYTOND_CONFIG environment variable. The database URI can be
specified in the TRYTOND_DATABASE_URI environment variable.

And SET produces among others:
TRYTOND_CONFIG=/etc/trytond.conf
TRYTOND_DATABASE_URI=postgresql://postgres:XXXXXXXX@postgres:5432/

PS: All these settings and manipulations made from within the container by
docker exec -u root -it tryton bin/bash

I think the problem is in the operations of trytond-admin.
even in verbose mode, it produces almost no output, so I can’t even know what happens on the back end. I am going to edit admin.py to add verbosity to the process.
————
With that, I need some help to understand where in DB (in what table) all modules are stored?

You should use the -v flag to increase the verbosity.
The verbosity increases with the number of v used. I will recomend using at least two flags:

trytond-admin -vv -d db_name -c /etc/trytond.conf -u fleets --activate-dependencies
1 Like

I added some
logger.info() strings.
I suggest add additional Exception if DB name is missing (the “for” loop with access to DB is skipped)

Constantine.

The uri in the config file does not contain information about the database due to a trytond server instance can work with many databases.
As @ced said you need to call trytond-admin with -d parameter to update the given database.

1 Like

Yes,
that was the problem.
My final string (successful):

trytond-admin -u fleets -m --logconf /etc/trytond.log.conf -c /etc/trytond.conf -vv -d tryton

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.