odoo_tools.modules.search.base_addons_path()[source]#

Find the path of odoo itself.

Returns:

Location where odoo is installed.

Return type:

Path

odoo_tools.modules.search.build_dependencies(modules, modules_lst, lookup_auto_install=True, deps=None, quiet=True)[source]#

Build dependencies with auto installable modules.

It’s more or less the same as build_module_dependencies, but it goes a step further by injecting auto dependent modules that have all their dependencies in the dependencies looked up first.

This by itself makes it possible to guess the modules that would need to be installed given the current addons path and specified modules that needs to be checked.

For example, if you wanted to check for the modules_lst = [‘sale’, ‘stock’]

It would first pull all the dependencies of the module sale, then it would pull all the dependencies of the module stock. Then it would lookup for all modules that are auto installable. If all of their dependencies are in the pulled dependencies. They’d get pulled into the dependencies.

Then it would check again for auto installable modules if any new dependency can pull more auto installable modules.

Unfortunately, it’s not possible to have 100% guarantee that you’ll get the exact same module set as in odoo. There is a guarantee that all the modules found will be installed. But odoo can request more modules to be installed as the account module that trigger some extra modules to be installed at init time.

Parameters:
  • modules (list(Manifest)) – List of all modules available

  • modules_lst (list(Manifest)) – List of manifest you want to find their dependencies

  • lookup_auto_install (bool) – Lookup for auto installable modules.

  • deps (dict) – List of already known dependencies

  • quiet (bool) – Silence missing dependencies logs

Returns:

dict of dependencies of the format {module: [dep1,…], …}

Return type:

dict

odoo_tools.modules.search.build_module_dependencies(modules, modules_lst=False, deps=None, quiet=True)[source]#

Generate dependencies of each modules passed in this function.

When all modules data is loaded, it is then possible to generate a graph of all the modules and their dependencies.

This graph then can be used in a topological sort to guess in which correct order the modules should be installed. Based on the dependencies, it’s also possible to guess which modules are required by one other module and find which modules are missing.

Parameters:
  • modules (list(Manifest)) – List of manifest to use for dependencies

  • modules_lst (list(Manifest)) – List of manifest to build dependencies for.

  • deps (dict) – Initial dependencies

  • quiet (bool) – Silence missing modules when they’re not present in the module set.

Returns:

A dictionary of {module: [dep,..], …} of the current set.

Return type:

dict

odoo_tools.modules.search.fast_search_manifests(path)[source]#

Quickly search into directoy for manifest files.

In order to speed up the search recursively, it will stop search in folders that have one of the possible manifest name.

It doesn’t loop through all files in the directory. Instead it checks for manifest files then if none are found, it will lookup for folders to look into.

All other files are skipped. Then the cycle repeats, until it finds a manifest or there are no more folders to search into.

Parameters:

path (Path) – Path in which the manifest lookup occurs.

Returns:

List of manifests paths.

Return type:

list(Path)

odoo_tools.modules.search.filter_installable(manifest)[source]#

Filter for installable modules

odoo_tools.modules.search.filter_noninstallable(manifest)[source]#

Filter for not installable modules.

This is mainly the opposite of filter_installable.

odoo_tools.modules.search.filter_python_dependencies(manifest)[source]#

Filter modules with python dependencies.

odoo_tools.modules.search.find_addons_paths(paths, options=False)[source]#

Find addons in provided paths.

Parameters:

paths (List<Path>) – A list of paths to search for addons.

Returns:

A list of manifests

Return type:

Set<Manifest>

odoo_tools.modules.search.find_modules(path, filters=None)[source]#

Search for manifests recursively in a specified folder.

Each Path is then converted to a Manifest object.

Parameters:
  • path (Path) – Path in which the manifest lookup occurs.

  • filters (Set(str)) – Set of filters to ignore some manifests.

Returns:

A list of valid manifests.

Return type:

list(Manifest)

odoo_tools.modules.search.find_modules_paths(paths, filters=None, options=None)[source]#

Search modules in multiple paths.

This can be used to search for odoo modules in different addons paths.

For example, you’d want to discover all odoo modules installed in your environment.

Parameters:
  • paths (list(Path)) – list of Path in which the manifest lookup occurs.

  • filters (Set(str)) – Set of filters to ignore some manifests.

  • options (object) – Object with a flag to exclude core odoo addons.

Returns:

All manifests in all the paths provided.

Return type:

list(Manifest)

odoo_tools.modules.search.get_filter(filter_names)[source]#

Returns a filter function with the provided filter names.

If all filter function returns True, then the object will not get filtered out of the set/list.

For example, a filter of installable, python_dependencies on a list of manifests will return all manifests that are installable and that have python dependencies.

Parameters:

filter_names (Set(str)) – Set of filter names.

Returns:

if the manifest validates the current set of

filters.

Return type:

Boolean

odoo_tools.modules.search.get_manifest(manifest, render_description=False)[source]#

Shortcut to get a manifest from path.

# TODO maybe this should be deprecated now.