akretion / docky

Docky - Helper for docker-compose mainly used in odoo context
GNU Affero General Public License v3.0
56 stars 31 forks source link

HOWTO create a clean odoo/spec.yaml with the modules list from an installed database #145

Closed rvalyi closed 2 years ago

rvalyi commented 2 years ago

Note to self: you can use this script in odoo shell:

from odoo import modules
from collections import defaultdict

installed_modules = env['ir.module.module'].search([('state', '=', 'installed')])
modules_with_path = [(m.name, modules.get_module_path(m.name).split('/')[-2]) for m in installed_modules]

d = defaultdict(set)
for item in modules_with_path:
    d[item[1]].add(item[0])

for k, vals in sorted(d.items()):
    print("\n%s:" % (k,))
    print("    modules: [")
    for mod in sorted(vals):
        print("        %s," % (mod,))
    print("    ]")

Will print something like:

[...]

timesheet:
    modules: [
        hr_timesheet_activity_begin_end,
        hr_timesheet_sheet,
        hr_timesheet_sheet_attendance,
        hr_timesheet_sheet_no_create,
        hr_timesheet_sheet_policy_department_manager,
        hr_timesheet_task_domain,
        hr_timesheet_task_stage,
        sale_timesheet_purchase,
    ]

usability:
    modules: [
        account_usability,
        base_usability,
        eradicate_quick_create,
        partner_tree_default,
        product_usability,
        purchase_product_tree_default,
        purchase_stock_usability,
        purchase_usability,
        sale_product_tree_default,
        sale_stock_usability,
        sale_usability,
        stock_account_usability,
        stock_product_tree_default,
        stock_usability,
    ]

web:
    modules: [
        web_advanced_search,
        web_dialog_size,
        web_drop_target,
        web_ir_actions_act_multi,
        web_ir_actions_act_view_reload,
        web_listview_range_select,
        web_m2x_options,
        web_notify,
        web_responsive,
        web_timeline,
        web_view_searchpanel,
        web_widget_color,
        web_widget_x2many_2d_matrix,
    ]