Getting a list of activated modules non-interactively

Hello,
for backup purposes on GNU Health I’m looking for a way to get a list of activated modules non-interactively. Can’t find something similar in trytond-admin command. I guess I could find a way on PostgreSQL level. But since the GNU Health client is able to show modules and their state at “Administration → Modules → Modules” there might be an existing option I am missing or maybe someone already wrote a script for this?
Best
Gerald

You could use trytond-admin with verbosity level 2 to update all activated modules, which outputs the module names (as well as a LOT of other info notices) to stderr.

(env) [tryton@starlord ~/trytond]$ trytond-admin -vv -c ./trytond.conf -d [database] --all 2> trytond-admin-modules.txt

I think it should be possible using the unix “cut” command to truncate the output lines after the column containing the module name (i.e. cut out just the first part of each line), then use “sort” and “uniq” to create a simple list of unique module names. However hopefully someone will provide a simpler option.

Dale

Another option may be trytond-console, something like:

trytond-console -c <tryton.conf> -d <database> <<EOF
Module = pool.get('ir.module')
modules = Module.search([('state', '=', 'activated')])
for module in modules:
    print(module.name)
EOF
1 Like

There are different ways to get the information:

  • Using a SQL query to get the information from the ir_module table
  • Using proteus to make a search on the ir.module Model
  • Using the update mecanism with a bit of grep and cut like @dalers hinted

Thanks a lot, much appreciated! Solution of dave was quite exactly what I was hoping for.
Had to upgrade vobject to resolve a ValueError but that comes from GNU Health version pinning, gotta take a look why that…

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