Пример #1
0
def load_marked_modules(cr, graph, states, force, progressdict, report,
                        loaded_modules, perform_checks, models_to_check=None):
    """Loads modules marked with ``states``, adding them to ``graph`` and
       ``loaded_modules`` and returns a list of installed/upgraded modules."""

    if models_to_check is None:
        models_to_check = set()

    processed_modules = []
    while True:
        cr.execute("SELECT name from ir_module_module WHERE state IN %s" ,(tuple(states),))
        module_list = [name for (name,) in cr.fetchall() if name not in graph]
        if not module_list:
            break
        graph.add_modules(cr, module_list, force)
        _logger.debug('Updating graph with %d more modules', len(module_list))
        loaded, processed = load_module_graph(
            cr, graph, progressdict, report=report, skip_modules=loaded_modules,
            perform_checks=perform_checks, models_to_check=models_to_check
        )
        processed_modules.extend(processed)
        loaded_modules.extend(loaded)
        if not processed:
            break
    return processed_modules
Пример #2
0
def force_demo(cr):
    """
    Forces the `demo` flag on all modules, and installs demo data for all installed modules.
    """
    graph = odoo.modules.graph.Graph()
    cr.execute(
        "SELECT name FROM ir_module_module WHERE state IN ('installed', 'to upgrade', 'to remove')"
    )
    module_list = [name for (name,) in cr.fetchall()]
    graph.add_modules(cr, module_list, ['demo'])

    for package in graph:
        load_demo(cr, package, {}, 'init')

    cr.execute('update ir_module_module set demo=%s', (True,))
    env = api.Environment(cr, SUPERUSER_ID, {})
    env['ir.module.module'].invalidate_cache(['demo'])
Пример #3
0
def load_marked_modules(cr,
                        graph,
                        states,
                        force,
                        progressdict,
                        report,
                        loaded_modules,
                        perform_checks,
                        models_to_check=None):
    """Loads modules marked with ``states``, adding them to ``graph`` and
       ``loaded_modules`` and returns a list of installed/upgraded modules."""

    if models_to_check is None:
        models_to_check = set()

    processed_modules = []
    while True:
        cr.execute("SELECT name from ir_module_module WHERE state IN %s",
                   (tuple(states), ))
        module_list = [name for (name, ) in cr.fetchall() if name not in graph]
        if not module_list:
            break
        graph.add_modules(cr, module_list, force)
        _logger.debug('Updating graph with %d more modules', len(module_list))
        loaded, processed = load_module_graph(cr,
                                              graph,
                                              progressdict,
                                              report=report,
                                              skip_modules=loaded_modules,
                                              perform_checks=perform_checks,
                                              models_to_check=models_to_check)
        processed_modules.extend(processed)
        loaded_modules.extend(loaded)
        if not processed:
            break
    return processed_modules